Commit graph

47 commits

Author SHA1 Message Date
Vitalii Elenhaupt
b6c0d3e8ad
Refactor comparison to boolean rule 2017-11-07 23:40:06 +02:00
Vitalii Elenhaupt
362b66ce81
Update run example 2017-11-07 23:07:25 +02:00
Vitalii Elenhaupt
e718c90f16
Source#content -> Source#code, Source::Error#pos -> Source::Error#location 2017-11-07 23:02:38 +02:00
Vitalii Elenhaupt
9036a7ca71
New rule: empty assignment 2017-11-07 20:54:28 +02:00
Vitalii Elenhaupt
a9421ee79b
AST node source code 2017-11-07 13:28:33 +02:00
V. Elenhaupt
adfe654733
Performance improvements (#15)
* Performance improvements

Two main changes:

1. Cache parsed AST in a Source. So Parser will parse content only once.
2. Use one unified visitor with multiple callbacks instead of multiple
visitors to traverse AST.

This improves performance significantly, for example running it on
Crystal repository takes ~1 second, which 6 times faster than before.

* Change readme example
2017-11-06 20:54:58 +02:00
Vitalii Elenhaupt
f27e32cbea
Benchmarks
closes #13

```
$ crystal bench/check_sources.cr --release
== Compare:
   1 source    1.1k ( 907.18µs) (± 2.24%)       fastest
  3 sources 649.18  (  1.54ms ) (± 2.26%)  1.70× slower
  5 sources 196.85  (  5.08ms ) (± 2.20%)  5.60× slower
 10 sources  96.37  ( 10.38ms ) (± 2.06%) 11.44× slower
 20 sources  58.88  ( 16.98ms ) (± 3.53%) 18.72× slower
 30 sources  46.43  ( 21.54ms ) (± 3.38%) 23.74× slower
 40 sources  46.19  ( 21.65ms ) (± 2.45%) 23.86× slower
== Measure:
  0.060000   0.040000   0.100000 (  0.080935 )
```
2017-11-06 14:27:49 +02:00
Vitalii Elenhaupt
f878ac430f
Refactor formatters 2017-11-06 10:41:03 +02:00
Vitalii Elenhaupt
1a3bb3629e
Line lenght: 80 symbols 2017-11-06 08:54:59 +02:00
V. Elenhaupt
374956f3dd
Fix travis build & new rule: constant names (#14) 2017-11-05 22:08:01 +02:00
Vitalii Elenhaupt
8440747353
New rule: variable names 2017-11-04 23:13:38 +02:00
Vitalii Elenhaupt
3d4c44c333
New rule: method names 2017-11-04 22:54:27 +02:00
Vitalii Elenhaupt
20fd53682f
New rule: type names 2017-11-04 18:57:35 +02:00
Vitalii Elenhaupt
e383ec17c2
Refactor tokenizer 2017-11-04 17:38:04 +02:00
Vitalii Elenhaupt
fedc29ceb6
Remove crystal syntax highliting 2017-11-04 16:49:50 +02:00
V. Elenhaupt
2f9ba27811
Large numbers rule + tokenizer (#10) 2017-11-04 16:43:40 +02:00
Vitalii Elenhaupt
3f2bcc56b9
Remove unused class 2017-11-03 16:44:32 +02:00
V. Elenhaupt
dff7e6a454
Travis: track only master branch 2017-11-03 12:12:45 +02:00
V. Elenhaupt
b6b62a73e7
Gitter badge 2017-11-02 10:39:29 +02:00
Vitalii Elenhaupt
75ec695a62
Colorize dot formatter
closes #1
2017-11-01 22:37:21 +02:00
Vitalii Elenhaupt
c9f229c3f1
Custom matcher 2017-11-01 22:05:41 +02:00
Vitalii Elenhaupt
67506fc643
New rule: negated conditions in unless 2017-11-01 21:30:30 +02:00
Vitalii Elenhaupt
996dc962db
Style improvements 2017-11-01 19:30:08 +02:00
Vitalii Elenhaupt
628077066e
Usage info & exclude lib/ project folder 2017-11-01 19:14:38 +02:00
V. Elenhaupt
6ca4e38167
Ameba cli & binary (#7)
* Ameba cli & binary

* -1 when ameba found issues

* Add postscript to shard.yml

* Correct postinstall

* Remove targets

* Try executables
2017-11-01 17:21:41 +02:00
Vitalii Elenhaupt
0ca990dd5c
New rule: predicate name 2017-11-01 15:20:04 +02:00
Vitalii Elenhaupt
348496ab9d
New rule: debugger statement 2017-11-01 14:44:00 +02:00
Vitalii Elenhaupt
64ccc7448c
New rule: literal in the interpolation 2017-11-01 14:18:28 +02:00
Vitalii Elenhaupt
6a81a648e3
AST Util 2017-11-01 13:13:44 +02:00
Vitalii Elenhaupt
dcc0be892a
Load list of rules dynamically 2017-11-01 12:49:03 +02:00
Vitalii Elenhaupt
1822b2b0a2
Fix line rule failure 2017-11-01 12:23:12 +02:00
Vitalii Elenhaupt
6f5d7f0478
New rule: a literal in the condition 2017-11-01 12:22:37 +02:00
Vitalii Elenhaupt
2eef485501
AST traverse 2017-11-01 01:06:47 +02:00
Vitalii Elenhaupt
f1e462cc86
Remove dsl & refactor ast visitors
closes #4
2017-11-01 00:50:22 +02:00
Vitalii Elenhaupt
6cef83f9a9
Correct doc syntax 2017-10-31 23:31:56 +02:00
Vitalii Elenhaupt
6d9f1c67ed
New rule: comparison to boolean 2017-10-31 23:30:22 +02:00
Vitalii Elenhaupt
11005930f6
New rule: UnlessElse 2017-10-31 22:24:02 +02:00
Vitalii Elenhaupt
93dd7d446f
AST parsing
closes #2
2017-10-31 20:29:30 +02:00
Vitalii Elenhaupt
b8eeac469a
New rule: trailing blank lines 2017-10-31 17:50:05 +02:00
Vitalii Elenhaupt
c8dcddea22
Rule dsl 2017-10-30 23:26:47 +02:00
Vitalii Elenhaupt
7d3d0902e5
New rule: trailing whitespace 2017-10-30 22:35:11 +02:00
Vitalii Elenhaupt
f7fc34db19
Badgefy 2017-10-30 22:10:03 +02:00
Vitalii Elenhaupt
9bba850a9b
Docs & tests 2017-10-30 22:00:01 +02:00
Vitalii Elenhaupt
5e10113055
It works 2017-10-27 00:07:43 +03:00
Vitalii Elenhaupt
ffd44dc77b
Simple reporter 2017-10-26 22:45:48 +03:00
Vitalii Elenhaupt
4e84ac871a
New rule: Line Length 2017-10-26 21:47:35 +03:00
Vitalii Elenhaupt
eb367c682e
Hello, Ameba 2017-10-26 19:46:58 +03:00