Skip to content

Commit

Permalink
[#8786] Platform: Add javafmtCheck to arc lint.
Browse files Browse the repository at this point in the history
Summary:
Add a script and regex linter that does this.
Current solution has few workarounds and is bit slow to run. But gets the job done.

KI:
There is impedence mismatch between javafmtCheckAll which checks all files and arc lint
which invokes multiple instances of checks one for each file.
Thus there is some redundant work being done.

Test Plan:
- Made chages to multiple java files that were not formatted.
Checked that arc lint fails
```
19:50 ~/code/yugabyte-db/managed [lint_javafmt] $ arc lint
>>> Lint for /home/sbapat/code/yugabyte-db:

   Error  (S&RX) Lint
    Unformatted files according to javafmt

   Error  (S&RX) Lint
    Unformatted files according to javafmt
19:50 ~/code/yugabyte-db/managed [lint_javafmt] $
```

- Made changes to multiple java files that were properly formatted.
Checke that arc lint does not fail
```
18:51 ~/code/yugabyte-db/managed [lint_javafmt] $ arc lint
 OKAY  No lint warnings.
```

- Combination of above (few well formatted and few badly formatted files)
```
19:51 ~/code/yugabyte-db/managed [lint_javafmt] $ arc lint
>>> Lint for managed/src/main/java/com/yugabyte/yw/models/Region.java:

   Error  (S&RX) Lint
    Unformatted files according to javafmt

   Error  (S&RX) Lint
    Unformatted files according to javafmt
19:52 ~/code/yugabyte-db/managed [lint_javafmt] $
```

Reviewers: arnav

Reviewed By: arnav

Subscribers: yugaware

Differential Revision: https://phabricator.dev.yugabyte.com/D11838
  • Loading branch information
sb-yb committed Jun 7, 2021
1 parent 0a7faa5 commit 5c1edb8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .arclint
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,25 @@
"(^src/postgres/.*$)",
"(^[.]gitmodules$)",
"(^managed/src/main/resources/v1.routes$)",
"(^managed/src/main/public/swagger-ui/)",
"(^managed/src/main/resources/swagger.json$)",
"(^managed/build.sbt$)",
"(^managed/src/main/resources/aws_pricing/.*$)"
],
"linters": {
"script-and-regex.script": {
"type": "script-and-regex",
"include": "(^managed/.*\\.java$)",
"script-and-regex.script":
"cd managed; sbt javafmtCheckAll; echo ",
"script-and-regex.regex":
"/^.*(?P<error>javafmtCheck).*(?P<message>Unformatted.*javafmt)\\:\\ (?P<file>.*)$/m"
},
"text": {
"type": "text",
"text.max-line-length": 100,
"exclude": [
"(^managed/ui/)",
"(^managed/src/main/public/swagger-ui/)",
"(^thirdparty/thirdparty_src_checksums[.]txt$)",
"(^java/yb-client/src/test/java/org/yb/client/TestYBClient[.]java$)",
"(^cmake_modules/cotire[.]cmake$)",
Expand Down

0 comments on commit 5c1edb8

Please sign in to comment.