Closed Yasumoto closed 4 years ago
Wouldn't a better solution be to change this to a project scoped linter and show the messages, instead of just discarding them?
That seems like the correct long-term solution, but as it stands now I'm not able to get any lint messages if (for instance) a dependency has an error on line 71 and my current file only has 50 lines.
I could circle back in a few days with an updated if you preferred that solution, but would need to dig into Atom's linting a bit first.
Make the above change and change the scope to project
, that should do it. (And take out the filtering, obviously.)
Hm, still getting the error with the posted diff. I'll take a little bit of time later this evening to dig in, since now I'm curious what I'm missing ๐
Error: Line number (77) greater than maximum line (50)
at Object.rangeFromLineNumber (/Users/jmsmith/.atom/packages/linter-foodcritic/node_modules/atom-linter/lib/index.js:178:11)
at /Users/jmsmith/.atom/packages/linter-foodcritic/lib/main.coffee:54:30
at run (/Users/jmsmith/.atom/packages/go-quick-import/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:89:22)
at /Users/jmsmith/.atom/packages/go-quick-import/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:102:28
at flush (/Users/jmsmith/.atom/packages/go-quick-import/node_modules/babel-polyfill/node_modules/core-js/modules/_microtask.js:18:9)
at doNTCallback0 (node.js:443:9)
at process._tickCallback (node.js:372:13)
Aha- this is because of the call to rangeFromLineNumber
. Not sure how you'd like to approach it, some options are either in-line that function or coordinate an atom-linter release which takes a path name instead of textEditor
.
Hmmmmm, if the file isn't the currently open file, maybe just return a range of a single character instead of using rangeFromLineNumber
? If the user opens the file then the first lint will turn that into a full line selection as the TextEditor will then be available. The list won't change too much since it only shows the start point of the range.
Are you still interested in working on this @Yasumoto?
Howdy @arcanemagus! Sorry for going quiet, Iโm pretty swamped so wonโt have cycles to fix this up. Please feel free to either close or carry forward! ๐โโ๏ธ
Although #18 correctly isolated the file to check,
foodcritic
still outputs messages for other files.This filters all messages to only look at ones that pertain to the current file.