maximus 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +99 -12
- data/lib/maximus/cli.rb +39 -20
- data/lib/maximus/config/maximus-example.yml +129 -0
- data/lib/maximus/config/maximus.yml +2 -0
- data/lib/maximus/config.rb +329 -0
- data/lib/maximus/git_control.rb +29 -47
- data/lib/maximus/helper.rb +10 -23
- data/lib/maximus/lint.rb +47 -26
- data/lib/maximus/lints/brakeman.rb +5 -2
- data/lib/maximus/lints/jshint.rb +7 -2
- data/lib/maximus/lints/railsbp.rb +5 -2
- data/lib/maximus/lints/rubocop.rb +5 -2
- data/lib/maximus/lints/scsslint.rb +4 -2
- data/lib/maximus/statistic.rb +23 -23
- data/lib/maximus/statistics/phantomas.rb +12 -7
- data/lib/maximus/statistics/stylestats.rb +20 -21
- data/lib/maximus/statistics/wraith.rb +34 -60
- data/lib/maximus/version.rb +1 -1
- data/lib/maximus.rb +1 -1
- data/maximus.gemspec +6 -6
- data/roadmap.md +2 -1
- metadata +25 -30
- data/lib/maximus/config/.jshintignore +0 -2
- data/lib/maximus/config/jshint.json +0 -9
- data/lib/maximus/config/phantomas.json +0 -4
- data/lib/maximus/config/phantomas_urls.yaml +0 -1
- data/lib/maximus/config/scsslint.yml +0 -58
- data/lib/maximus/config/stylestats.json +0 -30
- data/lib/maximus/config/wraith.yaml +0 -56
- data/lib/maximus/constants.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfcfe18a00fe7415422140b106609c011870cea5
|
4
|
+
data.tar.gz: db6a33810bb07a2fe58f0e29e9dd9e59f4c48e3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfef49478e9d9f9b994c80f77ab9c987963b6f396828023b9e99902254d03b2382b56755d8929ba96154cb41f0571e5b9474a66ea9378788c314f63f1e6c03c7
|
7
|
+
data.tar.gz: 2d38e52edb5a2cc6850d7f303d86d87d48a1e9f6c98237aed90f0a31b478c42a598549fa0f6d0164de2c0912abcdc253caf1b8fe084bb2d68b4f3056f8a70668
|
data/README.md
CHANGED
@@ -6,25 +6,81 @@ The all-in-one linting solution.
|
|
6
6
|
|
7
7
|
Plays nice with Middleman and Rails.
|
8
8
|
|
9
|
-
|
9
|
+
## Install
|
10
10
|
|
11
|
-
`gem 'maximus',
|
11
|
+
* Gemfile: `gem 'maximus', group: :development`
|
12
|
+
* Elsewhere/command line: `gem install maximus`
|
13
|
+
* Globally with RVM (~/.rvm/gemsets/global.gems): `maximus`
|
14
|
+
|
15
|
+
Maximus has several node dependencies that can be installed with a `npm install -g jshint phantomas stylestats` or a `maximus install` once the gem is successfully installed.
|
16
|
+
|
17
|
+
## Config
|
18
|
+
|
19
|
+
Lints and statistics can be configured turned on or off with a `maximus.yml` file in the root directory maximus is being called in. `config/maximus.yml` will be checked if a config file isn't found in the root, and if there's still no luck, [the default config](lib/maximus/config/maximus.yml) will be loaded.
|
20
|
+
|
21
|
+
Parent options are identical to the [command line flags](#command-line-flags) with the exception of `include` and `exclude`.
|
22
|
+
|
23
|
+
```yaml
|
24
|
+
domain: 'http://localhost'
|
25
|
+
port: 3000
|
26
|
+
paths:
|
27
|
+
home: '/'
|
28
|
+
```
|
29
|
+
|
30
|
+
Configs for each lint or statistic are identical to their own syntax.
|
31
|
+
|
32
|
+
```yaml
|
33
|
+
scsslint:
|
34
|
+
linters:
|
35
|
+
Compass::*:
|
36
|
+
enabled: true
|
37
|
+
```
|
38
|
+
|
39
|
+
For systems that are JavaScript based, like JSHint, the YAML is converted to JSON.
|
40
|
+
|
41
|
+
```yaml
|
42
|
+
jshint:
|
43
|
+
browser: true
|
44
|
+
unused: true
|
45
|
+
jquery: true
|
46
|
+
```
|
47
|
+
|
48
|
+
Some configs can be massive and it's more readable to break these into their own files. They can be loaded by setting the value to the path of the desired config.
|
49
|
+
|
50
|
+
```yaml
|
51
|
+
rubocop: 'config/rubocop.yml'
|
52
|
+
```
|
53
|
+
|
54
|
+
Systems and groups of systems can be disabled with booleans. Groups of systems override individual preferences.
|
55
|
+
|
56
|
+
```yaml
|
57
|
+
brakeman: false
|
58
|
+
statistics: false # no statistics will run
|
59
|
+
lints: true # all lints including brakeman will run
|
60
|
+
```
|
61
|
+
|
62
|
+
### [Sample Config](lib/maximus/config/maximus-example.yml)
|
12
63
|
|
13
64
|
## Command Line Flags
|
14
65
|
|
15
66
|
Flag | Accepts | Description
|
16
67
|
--------------------|----------------------------------|--------------------
|
17
|
-
`-
|
68
|
+
`-fp`/`--filepaths` | String/Array | Space-separated path(s) to files
|
69
|
+
`-u`/`--urls` | String/Array | Statistics only - Space-separated path(s) to relative URL paths
|
70
|
+
`-d`/`--domain` | String | Statistics only - Web address (prepended to paths)
|
71
|
+
`-po`/`--port` | String/Numeric | Statistics only - Port to use if required (appended to domain)
|
18
72
|
`-f`/`--frontend` | Boolean/Blank | Run all front-end lints
|
19
73
|
`-b`/`--backend` | Boolean/Blank | Run all back-end lints
|
20
|
-
`-s`/`--statistics` | Boolean/Blank | Run all
|
21
|
-
`-a`/`--all` | Boolean/Blank | Run
|
74
|
+
`-s`/`--statistics` | Boolean/Blank | Run all statistics
|
75
|
+
`-a`/`--all` | Boolean/Blank | Run everything
|
22
76
|
`-i`/`--include` | String/Array | Include specific lints or statistics
|
23
77
|
`-i`/`--exclude` | String/Array | Exclude specific lints or statistics
|
24
|
-
`-
|
78
|
+
`-git`/`--sha` | String | Run maximus based on a git commit, working copy (`working`, default), the last commit (`last` or `HEAD^`), or the master branch (`master`)
|
79
|
+
`-c`/`--config` | String | Path to config file
|
80
|
+
|
25
81
|
|
26
82
|
* Lint tasks can accept glob notation, i.e. `**/*.scss`
|
27
|
-
* Arrays are space-separated, i.e. `--
|
83
|
+
* Arrays are space-separated, i.e. `--urls=/ /about`
|
28
84
|
|
29
85
|
## Command Line Commands
|
30
86
|
|
@@ -35,23 +91,23 @@ Command | Description
|
|
35
91
|
`backend` | Runs all back-end lints
|
36
92
|
`statistics` | Runs all statistics
|
37
93
|
|
38
|
-
|
94
|
+
### Examples
|
39
95
|
|
40
96
|
Default. Lints based on your working directory
|
41
97
|
|
42
|
-
`maximus -
|
98
|
+
`maximus -g working`
|
43
99
|
|
44
100
|
Lints based on the previous commit by `HEAD^`
|
45
101
|
|
46
|
-
`maximus -
|
102
|
+
`maximus -g last`
|
47
103
|
|
48
104
|
Lints based on the commit on the master branch
|
49
105
|
|
50
|
-
`maximus -
|
106
|
+
`maximus -g master`
|
51
107
|
|
52
108
|
Lints based on commit d96a8e23
|
53
109
|
|
54
|
-
`maximus -
|
110
|
+
`maximus -g d96a8e23`
|
55
111
|
|
56
112
|
## Lint syntax
|
57
113
|
|
@@ -66,3 +122,34 @@ When adding new lints, the JSON output should obey the following format:
|
|
66
122
|
line: <position Integer>
|
67
123
|
} ]
|
68
124
|
```
|
125
|
+
|
126
|
+
## Changelog
|
127
|
+
|
128
|
+
### 0.1.3
|
129
|
+
|
130
|
+
Features:
|
131
|
+
|
132
|
+
* Options are defined once in Config class
|
133
|
+
* `maximus.yml` can be loaded to set the config
|
134
|
+
* All lint and statistic options can be in the maximus config file
|
135
|
+
* More command line flags
|
136
|
+
|
137
|
+
### 0.1.2 (December 18, 2014)
|
138
|
+
|
139
|
+
Features:
|
140
|
+
|
141
|
+
* Better inline documentation
|
142
|
+
|
143
|
+
Bugfixes:
|
144
|
+
|
145
|
+
* Resolve exiting error when no lint errors are preset (0efef67)
|
146
|
+
|
147
|
+
### 0.1.1 (December 9, 2014)
|
148
|
+
|
149
|
+
* Description and homepage update
|
150
|
+
|
151
|
+
### 0.1.0 (December 9, 2014)
|
152
|
+
|
153
|
+
* Initial
|
154
|
+
|
155
|
+
|
data/lib/maximus/cli.rb
CHANGED
@@ -2,15 +2,30 @@ require 'thor'
|
|
2
2
|
|
3
3
|
# @since 0.1.0
|
4
4
|
class Maximus::CLI < Thor
|
5
|
+
|
5
6
|
include Thor::Actions
|
6
|
-
|
7
|
-
class_option :frontend,
|
8
|
-
class_option :backend,
|
9
|
-
class_option :statistics,
|
10
|
-
class_option :all,
|
11
|
-
|
12
|
-
class_option :
|
13
|
-
class_option :
|
7
|
+
|
8
|
+
class_option :frontend, aliases: ['-f', '--front-end'], type: :boolean, default: false, lazy_default: false, desc: "Do front-end lints"
|
9
|
+
class_option :backend, aliases: ['-b', '--back-end'], type: :boolean, default: false, lazy_default: false, desc: "Do back-end lints"
|
10
|
+
class_option :statistics, aliases: ['-s'], type: :boolean, default: false, lazy_default: false, desc: "Do statistics"
|
11
|
+
class_option :all, aliases: ['-a'], type: :boolean, default: false, lazy_default: false, desc: "Do everything"
|
12
|
+
|
13
|
+
class_option :filepath, aliases: ['-fp'], type: :array, default: [], desc: "Space-separated path(s) to files"
|
14
|
+
class_option :urls, aliases: ['-u'], type: :array, default: ['/'], desc: "Statistics only - Space-separated path(s) to relative URL paths"
|
15
|
+
class_option :domain, aliases: ['-d'], type: :string, default: 'http://localhost', desc: "Statistics only - Web address (prepended to paths)"
|
16
|
+
class_option :port, aliases: ['-po'], type: :numeric, default: nil, desc: 'Statistics only - Port to use if required (appended to domain)'
|
17
|
+
|
18
|
+
class_option :include, aliases: ['-i'], type: :array, default: [], desc: "Include only specific lints or statistics"
|
19
|
+
class_option :exclude, aliases: ['-e'], type: :array, default: [], desc: "Exlude specific lints or statistics"
|
20
|
+
|
21
|
+
class_option :config, aliases: ['-c'], type: :string, default: 'maximus.yml', desc: 'Path to config file'
|
22
|
+
|
23
|
+
class_option :git, aliases: ['-g', '--sha'], type: :string, default: 'working', banner: "working, last, master, or sha", desc: "Lint by commit or working copy"
|
24
|
+
|
25
|
+
def initialize(*args)
|
26
|
+
super
|
27
|
+
@config ||= Maximus::Config.new(default_options)
|
28
|
+
end
|
14
29
|
|
15
30
|
desc "frontend", "Execute all front-end tasks"
|
16
31
|
def frontend
|
@@ -44,11 +59,11 @@ class Maximus::CLI < Thor
|
|
44
59
|
# If include flag is enabled, run based on what's included
|
45
60
|
return options[:include].each { |i| send(i) } unless options[:include].blank?
|
46
61
|
# If all flag is not enabled, lint working copy as it's supposed to be
|
47
|
-
|
62
|
+
@config.settings[:commit] = options[:git]
|
63
|
+
return Maximus::GitControl.new({config: @config}).lints_and_stats(true)
|
48
64
|
end
|
49
65
|
|
50
66
|
# @todo something better than just installing in the global npm file
|
51
|
-
# and including phantomjs
|
52
67
|
desc "install", "Install all dependencies"
|
53
68
|
def install
|
54
69
|
`npm install -g jshint phantomas stylestats`
|
@@ -65,41 +80,45 @@ class Maximus::CLI < Thor
|
|
65
80
|
end
|
66
81
|
def default_options
|
67
82
|
{
|
68
|
-
|
69
|
-
|
83
|
+
file_paths: options[:filepath],
|
84
|
+
paths: options[:urls],
|
85
|
+
domain: options[:domain],
|
86
|
+
port: options[:port],
|
87
|
+
is_dev: true,
|
88
|
+
config_file: options[:config]
|
70
89
|
}
|
71
90
|
end
|
72
91
|
|
73
92
|
def scsslint
|
74
|
-
Maximus::Scsslint.new(
|
93
|
+
Maximus::Scsslint.new({config: @config}).result
|
75
94
|
end
|
76
95
|
|
77
96
|
def jshint
|
78
|
-
Maximus::Jshint.new(
|
97
|
+
Maximus::Jshint.new({config: @config}).result
|
79
98
|
end
|
80
99
|
|
81
100
|
def rubocop
|
82
|
-
Maximus::Rubocop.new(
|
101
|
+
Maximus::Rubocop.new({config: @config}).result
|
83
102
|
end
|
84
103
|
|
85
104
|
def railsbp
|
86
|
-
Maximus::Railsbp.new(
|
105
|
+
Maximus::Railsbp.new({config: @config}).result
|
87
106
|
end
|
88
107
|
|
89
108
|
def brakeman
|
90
|
-
Maximus::Brakeman.new(
|
109
|
+
Maximus::Brakeman.new({config: @config}).result
|
91
110
|
end
|
92
111
|
|
93
112
|
def stylestats
|
94
|
-
Maximus::Stylestats.new(
|
113
|
+
Maximus::Stylestats.new({config: @config}).result
|
95
114
|
end
|
96
115
|
|
97
116
|
def phantomas
|
98
|
-
Maximus::Phantomas.new(
|
117
|
+
Maximus::Phantomas.new({config: @config}).result
|
99
118
|
end
|
100
119
|
|
101
120
|
def wraith
|
102
|
-
Maximus::Wraith.new(
|
121
|
+
Maximus::Wraith.new({config: @config}).result
|
103
122
|
end
|
104
123
|
end
|
105
124
|
|
@@ -0,0 +1,129 @@
|
|
1
|
+
# Config for all
|
2
|
+
domain: 'http://localhost'
|
3
|
+
port: 3000
|
4
|
+
|
5
|
+
paths:
|
6
|
+
home: '/'
|
7
|
+
|
8
|
+
# Lints
|
9
|
+
|
10
|
+
# lints: true # enable all lints
|
11
|
+
|
12
|
+
scsslint:
|
13
|
+
scss_files: 'app/assets/stylesheets/'
|
14
|
+
|
15
|
+
# output format will always be JSON, so don't bother setting
|
16
|
+
# Format: whatever
|
17
|
+
|
18
|
+
linters:
|
19
|
+
Compass::*:
|
20
|
+
enabled: true
|
21
|
+
Compass::PropertyWithMixin:
|
22
|
+
ignore:
|
23
|
+
- 'inline-block'
|
24
|
+
- 'border-radius'
|
25
|
+
- 'box-shadow'
|
26
|
+
- 'opacity'
|
27
|
+
- 'text-shadow'
|
28
|
+
Indentation:
|
29
|
+
enabled: false
|
30
|
+
character: tab
|
31
|
+
severity: warning
|
32
|
+
width: 1
|
33
|
+
NameFormat:
|
34
|
+
convention: BEM
|
35
|
+
enabled: false
|
36
|
+
SelectorFormat:
|
37
|
+
enabled: false
|
38
|
+
DeclarationOrder:
|
39
|
+
enabled: false
|
40
|
+
EmptyLineBetweenBlocks:
|
41
|
+
enabled: false
|
42
|
+
NestingDepth:
|
43
|
+
max_depth: 6
|
44
|
+
severity: error
|
45
|
+
SelectorDepth:
|
46
|
+
max_depth: 5
|
47
|
+
severity: error
|
48
|
+
LeadingZero:
|
49
|
+
enabled: false
|
50
|
+
PlaceholderInExtend:
|
51
|
+
enabled: false
|
52
|
+
PropertySortOrder:
|
53
|
+
enabled: false
|
54
|
+
QualifyingElement:
|
55
|
+
enabled: true
|
56
|
+
allow_element_with_attribute: true
|
57
|
+
SpaceAfterPropertyColon:
|
58
|
+
enabled: false
|
59
|
+
UnnecessaryParentReference:
|
60
|
+
severity: error
|
61
|
+
VendorPrefixes:
|
62
|
+
exclude:
|
63
|
+
- '-webkit-tap-highlight-color'
|
64
|
+
- '-webkit-font-smoothing'
|
65
|
+
- '-moz-osx-font-smoothing'
|
66
|
+
- '-webkit-appearance'
|
67
|
+
- '-moz-placeholder'
|
68
|
+
- '-ms-input-placeholder'
|
69
|
+
- '-moz-pre-wrap'
|
70
|
+
|
71
|
+
jshint:
|
72
|
+
browser: true
|
73
|
+
esnext: true
|
74
|
+
globals: {}
|
75
|
+
globalstrict: true
|
76
|
+
undef: true
|
77
|
+
unused: true
|
78
|
+
jquery: true
|
79
|
+
|
80
|
+
rubocop: 'rubocop.yml'
|
81
|
+
|
82
|
+
brakeman: true
|
83
|
+
|
84
|
+
rails_best_practice: false
|
85
|
+
|
86
|
+
# Statistics
|
87
|
+
phantomas:
|
88
|
+
block-domain: 'google-analytics.com'
|
89
|
+
skip-modules:
|
90
|
+
- 'Caching'
|
91
|
+
- 'localStorage'
|
92
|
+
- 'Cookies'
|
93
|
+
- 'assetsWithQueryString'
|
94
|
+
- 'nodesWithInlineCSS'
|
95
|
+
|
96
|
+
stylestats:
|
97
|
+
published: false
|
98
|
+
paths: false
|
99
|
+
stylesheets: false
|
100
|
+
styleElements: true
|
101
|
+
size: true
|
102
|
+
dataUriSize: true
|
103
|
+
ratioOfDataUriSize: true
|
104
|
+
gzippedSize: false
|
105
|
+
simplicity: true
|
106
|
+
rules: true
|
107
|
+
selectors: true
|
108
|
+
mostIdentifier: true
|
109
|
+
mostIdentifierSelector: true
|
110
|
+
lowestCohesion: true
|
111
|
+
lowestCohesionSelector: true
|
112
|
+
totalUniqueFontSizes: true
|
113
|
+
uniqueFontSize: true
|
114
|
+
totalUniqueColors: true
|
115
|
+
uniqueColor: true
|
116
|
+
idSelectors: true
|
117
|
+
universalSelectors: true
|
118
|
+
unqualifiedAttributeSelectors: true
|
119
|
+
javascriptSpecificSelectors: "[#\\.]js\\-"
|
120
|
+
importantKeywords: true
|
121
|
+
floatProperties: true
|
122
|
+
mediaQueries: true
|
123
|
+
propertiesCount: 10
|
124
|
+
requestOptions: {}
|
125
|
+
|
126
|
+
wraith:
|
127
|
+
browser:
|
128
|
+
phantomjs: phantomjs
|
129
|
+
casperjs: casperjs
|