Closed Defman21 closed 7 years ago
It supports JSON output so it could be pretty easy to integrate.
An example JSON:
{
"metadata": {
"rubocop_version": "0.47.1",
"ruby_engine": "ruby",
"ruby_version": "2.3.3",
"ruby_patchlevel": "222",
"ruby_platform": "x86_64-linux"
},
"files": [
{
"path": "lib/twitch_bot.rb",
"offenses": [
{
"severity": "convention",
"message": "Missing top-level module documentation comment.",
"cop_name": "Style/Documentation",
"corrected": null,
"location": {
"line": 4,
"column": 3,
"length": 6
}
}
]
}
],
"summary": {
"offense_count": 1,
"target_file_count": 1,
"inspected_file_count": 1
}
}
Or you can simply point me to the right direction and I'll send a pull request to you. 😇
Can you explain what this is and what you imagine "integration" would entail?
Rubocop checks your code in the same way as pep8 does. It has a lot of rules that you should follow to keep your code clean. It'd give you different warnings so you'd fix them. Basically, it's a linter but it checks your code style and not errors in it.
And I think I've used the integration word wrong 😛
Sounds like just another linter like pylint or something. Adding to backlog.
Yep, you're right.
I assume I need to modify this file to add a linter? https://github.com/Komodo/KomodoEdit/blob/master/src/lint/koCSSExLinter.py
Oops that's for CSS.
@mitchell-as PR's welcome? :)
Sure, if you're feeling so inclined :)
Would you rather accept this as a PR or as an add-on? I've managed to make it working in both cases.
I think an addon would be preferable for now but that's more @Naatan's call. Please post your solution to the problems you were having back in the forum post you started.
In case you'd want to be it a built-in linter, here's the code you might want to review:
https://github.com/Defman21/korubocop/blob/master/components/koRubocopLinter.py
Note there's a case when I lint the actual file instead of a temporary one. This is needed when there's a rubocop configuration in the root of a project which has relative paths in it's config blocks (such as directories to ignore, etc).
@Defman21 Looks great. PR it? :)
I'll do that tomorrow :)
Retargeting for 11 in order to review PR.
Short Summary
Rubocop is pep8 in Ruby world, and I'd want to see it in Komodo :)