chipsalliance / chipsalliance/rocket-chip

Add ScalaStyle style checker

Open
#255 6 comments 0 reactions 0 assignees View on GitHub
proposal
Dominant language
Scala
Stars
3.9k
Forks
1.3k
Avg merge
5d 13m
Merged PRs (30d)
1

Description

What does everyone think about adding the [ScalaStyle](http://www.scalastyle.org/) style checker to `rocket-chip` in order to enforce a consistent style and to prevent certain classes of errors? I tried running the style checker on the current version of the code, and there are 2818 errors. Here's the counts of all the types of errors:

```
1398 Public method must have explicit type
770 Whitespace at end of line
238 There should be a space before the plus (+) sign
176 If block needs braces
96 There should be a space after the plus (+) sign
42 File line length exceeds 160 characters
24 Avoid using null
14 Boolean expression can be simplified
12 Number of types declared in the file exceeds 30
10 Regular expression matched 'println'
8 Method is longer than 50 lines
8 File length exceeds 800 lines
6 Avoid using return
4 Cyclomatic complexity of 13 exceeds max of 10
2 The number of parameters should not exceed 8
2 Number of methods in class exceeds 30
2 Line contains a tab
2 Expected token RPAREN but got Token(EQUALS,=,9269,=)
2 Cyclomatic complexity of 16 exceeds max of 10
2 Cyclomatic complexity of 11 exceeds max of 10
```

We can also disable any checks that we don't want.

If you think it's worth adding, I can create a PR along with an update to the Travis settings to automatically run the linter.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the ScalaStyle output described in the issue and the repository's Travis settings. Decide which checks should remain enabled or be disabled, then configure the checker and update Travis so it runs automatically; done means the chosen checks are integrated without the current unreviewed error set blocking the project.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
ci-cd, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.