Commit graph

180 commits

Author SHA1 Message Date
Sijawusz Pur Rahnama
ea98554191
Add support for showing end location marker (#200)
* Add support for showing end location marker

* Cleanup Reportable method definitions

There’s no need for double splats, since they mess up method resolution, and obscure the actual - single (!) - argument - `status`, so… be gone

Also, all of the helpers return the constructed `Issue` like a behaving good methods.

* Refactor Util#affected_code

* Increase max length of trimmed lines to 120 characters

* Refactor Issue to use enum instead of a symbol for #status

* Optimize Reportable#valid?

* Add spec coverage for newly added Util methods

* Refactor DotFormatter a bit

Make text format moar in line with Crystal spec runner.

* Update README.md
2021-01-26 08:38:19 +02:00
Sijawusz Pur Rahnama
6acb8ad2eb ChainedCallsWithNoBang -> ChainedCallWithNoBang 2021-01-22 17:24:45 +01:00
Sijawusz Pur Rahnama
d3b952f58a Add Performance/ChainedCallsWithNoBang rule 2021-01-21 12:47:10 +01:00
Sijawusz Pur Rahnama
ad8f570a04 Change Rule to class 2021-01-19 22:17:17 +01:00
Sijawusz Pur Rahnama
ddaa58f475
Merge pull request #192 from crystal-ameba/feature/flatten-after-map-rule
Add Performance/FlattenAfterMap rule
2021-01-19 22:16:10 +01:00
Sijawusz Pur Rahnama
23b4b4c4f0 Add Performance/FlattenAfterMap rule 2021-01-18 18:04:54 +01:00
Sijawusz Pur Rahnama
b7286dc673 Add Performance/CompactAfterMap rule 2021-01-18 18:04:12 +01:00
Sijawusz Pur Rahnama
d2fa75280f
Extend JoinAfterMap to check also calls to sum/product and rename it to MapInsteadOfBlock (#190) 2021-01-18 17:42:50 +02:00
Vitalii Elenhaupt
e9ec91654c New Rule: Lint/DuplicatedRequire
closes https://github.com/crystal-ameba/ameba/issues/176
2021-01-17 22:32:24 +02:00
Sijawusz Pur Rahnama
a892cd43b0 Add Performance/JoinAfterMap rule 2021-01-17 16:57:15 +01:00
Sijawusz Pur Rahnama
1a091c1f1a
Optimize rules (#185)
* Replace pointless interpolations with actual values

* Rules optimizations

* Stylistic refactors

* Remove extraneous blank lines

* Remove some instances of .not_nil! usage
2021-01-17 14:16:04 +02:00
Sijawusz Pur Rahnama
c4d34d74d8
Add support for showing code context lines (#181)
* Add support for showing code context lines

* Show context lines only in ExplainFormatter

* Add spec coverage for context_lines option
2021-01-12 17:20:43 +02:00
Sijawusz Pur Rahnama
2eff832669 Add --rules switch to the CLI 2021-01-09 21:01:04 +01:00
Vitalii Elenhaupt
5b4b1e817d
Improve forward compatibility with future crystal version
https://github.com/crystal-ameba/ameba/issues/168#issuecomment-722051876
2020-11-05 10:23:25 +02:00
Vitalii Elenhaupt
44290a6a5d
Handle case when compiler reports incorrect node location
fixes #168
2020-10-23 10:41:17 +03:00
Vitalii Elenhaupt
f8d57345d4
Merge branch 'develop' 2020-08-26 22:46:03 +03:00
Vitalii Elenhaupt
b5bd76dfa8
Useless Assign: ignore variables with '_' prefix
closes #164
2020-08-20 21:15:58 +03:00
Vitalii Elenhaupt
d650ca5477
Incorrectly reporting shadowingOuterLocalVar within macro included
closes #161
2020-07-15 10:18:12 +03:00
Vitalii Elenhaupt
7f501a1df5
RedundantStringCoercion: do not report to_s with named args
closes #160
2020-06-24 09:26:03 +03:00
Vitalii Elenhaupt
c3260c1740
Move to YAML::Serializable 2020-06-15 14:29:49 +03:00
Vladislav Trotsenko
bdeb6e3391
Feature/Layout trailing lines, final newline checkup (#152) 2020-05-05 16:52:24 +03:00
Matheus Richard
f1adf14527
Handle duplicated files on GlobUtils (#151)
* Handle duplicated files on GlobUtils

* Update src/ameba/glob_utils.cr

Co-Authored-By: George Dietrich <yomoejoe@gmail.com>

Co-authored-by: George Dietrich <yomoejoe@gmail.com>
2020-04-19 11:52:15 +03:00
Vitalii Elenhaupt
478da94c20
Allow constants to be in PascalCase (i.e. Log, SuperConstant)
closes #148
2020-04-13 09:38:05 +03:00
Sijawusz Pur Rahnama
1a25583036
Make InlineComments::COMMENT_DIRECTIVE_REGEX more strict (#146) 2020-04-11 09:55:41 +03:00
Vitalii Elenhaupt
458c492730
Do not report shadowing outer local var is var is declared below the
shadowed var

closes #144
2020-04-10 10:44:42 +03:00
Vitalii Elenhaupt
99c65b5a28
New rule: Lint/BadDirective (#143)
* New rule: Lint/BadDirective

* Address PR feedback
2020-04-06 15:10:34 +03:00
Vitalii Elenhaupt
db6b54e63c
New rule: Style/IsANil 2020-03-29 19:45:13 +03:00
Vitalii Elenhaupt
04497feeed
Lint/LiteralInInterpolation: properly report node position 2020-03-27 19:44:04 +02:00
Brian J. Cardiff
24b9156f19 Avoid creating an invalid RegexLiteral 2020-03-27 09:21:13 -03:00
Vitalii Elenhaupt
59bc021e57
Do not report if Object#to_s is called without receiver 2020-03-26 23:51:54 +02:00
Vitalii Elenhaupt
ff1669ebe8
New rule: Lint/RedundantStringCoercion 2020-03-26 16:26:27 +02:00
Vitalii Elenhaupt
a6958ab455
New rule: EmptyLoop 2020-03-26 10:27:00 +02:00
Vitalii Elenhaupt
1d827b4969
Add specs for COMMENT_DIRECTIVE_REGEX 2020-03-25 18:14:15 +02:00
Vitalii Elenhaupt
4f185db0a2
New rule: SharedVarInSpawn
closes #132
2020-03-25 17:52:20 +02:00
Vitalii Elenhaupt
0002c36fae
RedundantNext params 2020-03-24 18:27:49 +02:00
Vitalii Elenhaupt
a5dd07e9e4
New rule: RedundantNext
closes #131
2020-03-24 18:06:01 +02:00
Vitalii Elenhaupt
946ec67fae
Include binary op node to redundant return 2020-03-22 20:12:24 +02:00
Vitalii Elenhaupt
2303bd82ae
Ability to excluded globally 2020-03-22 15:05:47 +02:00
Vitalii Elenhaupt
bffc46c545
Ability to configure globs 2020-03-22 15:05:47 +02:00
Vitalii Elenhaupt
aff723b682
Incorrectly reporting shadowingOuterLocalVar within macro included
closes #129
2020-02-15 20:49:47 +02:00
Vitalii Elenhaupt
74dfa0b934
Lint/UselessAssign: ignore transformed assignemnts by the compiler
closes #127
2020-01-11 23:51:28 +02:00
Vitalii Elenhaupt
6b56c87e78
Shadowing via short instance variable syntax
closes #122
2019-11-11 15:51:09 +02:00
Vitalii Elenhaupt
fde321f7e6
New rule: RedundantWithObject (#121) 2019-11-10 09:47:30 +02:00
Vitalii Elenhaupt
b6cc454039
New rule: RedundantWithIndex (#120) 2019-11-10 09:29:17 +02:00
Vitalii Elenhaupt
07e72b7bf9
Lint in parallel (#118)
* Lint in parallel

* Synced output for dot/flycheck formatters

* Re-raise exceptions raised in fibers

* Add readme instructions
2019-11-09 19:31:41 +02:00
Vitalii Elenhaupt
4ae0195628
Avoid duplicated sections in a generated TODO file (additional fix) 2019-10-27 22:56:53 +02:00
Vitalii Elenhaupt
111596541b
Avoid duplicated sections in a generated TODO file 2019-10-27 22:15:04 +02:00
Vitalii Elenhaupt
904b5beec2
Lint/UnusedArgument: fails to recognized used argument inside macro
closes #117
2019-10-27 21:32:55 +02:00
Vitalii Elenhaupt
677c75716f
Typeof scope 2019-10-27 21:22:33 +02:00
Vitalii Elenhaupt
2704a0d8b1
Do not generate todo file there are no issues 2019-10-27 17:49:30 +02:00