-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce npm run lint command for cpp formatting #752
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const util = require('../lib/util') | ||
|
||
const lint = (options = {}) => { | ||
util.lint() | ||
} | ||
|
||
module.exports = lint |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ const chromiumRebaseL10n = require('../lib/chromiumRebaseL10n') | |
const createDist = require('../lib/createDist') | ||
const upload = require('../lib/upload') | ||
const test = require('../lib/test') | ||
const lint = require('../lib/lint') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think maybe you moved it to util but this is still around and it should get it from util instead. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did you forget to add lint.js? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops. I forgot to add |
||
|
||
program | ||
.version(process.env.npm_package_version) | ||
|
@@ -105,5 +106,9 @@ program | |
.arguments('[build_config]') | ||
.action(test) | ||
|
||
program | ||
.command('lint') | ||
.action(lint) | ||
|
||
program | ||
.parse(process.argv) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is rietveld.server?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is code review site of chromium project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused about what
git cl
has to do with lint. We want to callvendor/depot_tools/cpplint.py
in some kind of push hookThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't read full
git_cl.py
,but it seems it uses cpplint.py for lint internally.it seems it utilizes clang_format.py.How about providing two kinds of formatting ways -
npm run lint
and git hook?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git cl
is utilities for chromium code review - https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/git-cl.htmlIt has many subcommands and we can easily use
format
orlint
subcommand for our formattingThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but there's no changelist to run it on. We need it to run on directory. I just tried to run and got
Cannot lint an empty CL
we also need to make sure we're using cpplint.py in all cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you have any modification in
src/brave
?That command tries to reformat files that has changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lint should fail right now whether there are changes or not because I've seen dozens of what would be lint errors in the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use
format
it will detect the errors.As I told you in DM, if we want to use
cpplint.py
instead ofclang_format
,git cl
would not be the good choice.