lint_trap 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +97 -0
- data/Dockerfile +222 -0
- data/Gemfile +2 -0
- data/Rakefile +45 -0
- data/circle.yml +22 -0
- data/config/checkstyle/checkstyle_logger-all.jar +0 -0
- data/config/checkstyle/sun_checks.xml +177 -0
- data/config/coffeelint/lint_trap.coffee +12 -0
- data/config/jshint/formatter.js +22 -0
- data/config/rubocop/formatter.rb +22 -0
- data/config/scsslint/scsslint +34 -0
- data/lib/lint_trap/command.rb +39 -0
- data/lib/lint_trap/container/base.rb +30 -0
- data/lib/lint_trap/container/docker.rb +46 -0
- data/lib/lint_trap/container/fake.rb +28 -0
- data/lib/lint_trap/language/base.rb +18 -0
- data/lib/lint_trap/language/coffeescript.rb +13 -0
- data/lib/lint_trap/language/cpp.rb +17 -0
- data/lib/lint_trap/language/css.rb +13 -0
- data/lib/lint_trap/language/go.rb +13 -0
- data/lib/lint_trap/language/java.rb +13 -0
- data/lib/lint_trap/language/javascript.rb +13 -0
- data/lib/lint_trap/language/json.rb +13 -0
- data/lib/lint_trap/language/python.rb +13 -0
- data/lib/lint_trap/language/ruby.rb +13 -0
- data/lib/lint_trap/language/scss.rb +13 -0
- data/lib/lint_trap/language.rb +50 -0
- data/lib/lint_trap/linter/base.rb +58 -0
- data/lib/lint_trap/linter/checkstyle.rb +24 -0
- data/lib/lint_trap/linter/coffeelint.rb +21 -0
- data/lib/lint_trap/linter/cppcheck.rb +18 -0
- data/lib/lint_trap/linter/csslint.rb +23 -0
- data/lib/lint_trap/linter/golint.rb +19 -0
- data/lib/lint_trap/linter/jshint.rb +20 -0
- data/lib/lint_trap/linter/jsonlint.rb +18 -0
- data/lib/lint_trap/linter/pylint.rb +19 -0
- data/lib/lint_trap/linter/rubocop.rb +22 -0
- data/lib/lint_trap/linter/scsslint.rb +22 -0
- data/lib/lint_trap/linter.rb +42 -0
- data/lib/lint_trap/{parsers/base_parser.rb → parser/base.rb} +8 -9
- data/lib/lint_trap/{parsers/csslint_parser.rb → parser/csslint.rb} +4 -5
- data/lib/lint_trap/{parsers/line_parser.rb → parser/line.rb} +14 -5
- data/lib/lint_trap/parser/standard.rb +22 -0
- data/lib/lint_trap/parser/vim_quickfix.rb +19 -0
- data/lib/lint_trap/version.rb +1 -1
- data/lib/lint_trap.rb +5 -14
- data/lint_trap.gemspec +3 -0
- data/spec/command_spec.rb +38 -0
- data/spec/container/docker_spec.rb +34 -0
- data/spec/container/fake_spec.rb +29 -0
- data/spec/fixtures/Good.java +6 -0
- data/spec/fixtures/bad.coffee +1 -0
- data/spec/fixtures/bad.cpp +5 -0
- data/spec/fixtures/bad.css +4 -0
- data/spec/fixtures/bad.go +7 -0
- data/spec/fixtures/bad.java +3 -0
- data/spec/fixtures/bad.js +3 -0
- data/spec/fixtures/bad.json +4 -0
- data/spec/fixtures/bad.py +2 -0
- data/spec/fixtures/bad.rb +4 -0
- data/spec/fixtures/bad.scss +3 -0
- data/spec/fixtures/good.coffee +1 -0
- data/spec/fixtures/good.cpp +4 -0
- data/spec/fixtures/good.css +3 -0
- data/spec/fixtures/good.go +7 -0
- data/spec/fixtures/good.js +5 -0
- data/spec/fixtures/good.json +4 -0
- data/spec/fixtures/good.py +6 -0
- data/spec/fixtures/good.rb +5 -0
- data/spec/fixtures/good.scss +3 -0
- data/spec/fixtures/lint.txt +1 -0
- data/spec/integration/checkstyle_spec.rb +52 -0
- data/spec/integration/coffeelint_spec.rb +44 -0
- data/spec/integration/cppcheck_spec.rb +60 -0
- data/spec/integration/csslint_spec.rb +44 -0
- data/spec/integration/golint_spec.rb +44 -0
- data/spec/integration/jshint_spec.rb +70 -0
- data/spec/integration/jsonlint_spec.rb +60 -0
- data/spec/integration/pylint_spec.rb +51 -0
- data/spec/integration/rubocop_spec.rb +52 -0
- data/spec/integration/scsslint_spec.rb +44 -0
- data/spec/language/coffeescript_spec.rb +8 -0
- data/spec/language/cpp_spec.rb +8 -0
- data/spec/language/css_spec.rb +8 -0
- data/spec/language/go_spec.rb +8 -0
- data/spec/language/java_spec.rb +8 -0
- data/spec/language/javascript_spec.rb +8 -0
- data/spec/language/json_spec.rb +8 -0
- data/spec/language/python_spec.rb +8 -0
- data/spec/language/ruby_spec.rb +8 -0
- data/spec/language/scss_spec.rb +8 -0
- data/spec/language_spec.rb +143 -0
- data/spec/lint_trap_spec.rb +0 -16
- data/spec/linter/checkstyle_spec.rb +45 -0
- data/spec/linter/coffeelint_spec.rb +46 -0
- data/spec/linter/cppcheck_spec.rb +26 -0
- data/spec/linter/csslint_spec.rb +44 -0
- data/spec/linter/golint_spec.rb +22 -0
- data/spec/linter/jshint_spec.rb +44 -0
- data/spec/linter/jsonlint_spec.rb +22 -0
- data/spec/linter/pylint_spec.rb +46 -0
- data/spec/linter/rubocop_spec.rb +48 -0
- data/spec/linter/scsslint_spec.rb +44 -0
- data/spec/linter_spec.rb +67 -0
- data/spec/parser/csslint_spec.rb +25 -0
- data/spec/{parsers/standard_parser_spec.rb → parser/standard_spec.rb} +4 -3
- data/spec/{parsers/vim_quickfix_parser_spec.rb → parser/vim_quickfix_spec.rb} +5 -4
- data/spec/spec_helper.rb +8 -0
- data/spec/support/fixture_file_helper.rb +8 -0
- metadata +193 -18
- data/lib/lint_trap/parser_factory.rb +0 -32
- data/lib/lint_trap/parsers/null_parser.rb +0 -11
- data/lib/lint_trap/parsers/standard_parser.rb +0 -23
- data/lib/lint_trap/parsers/vim_quickfix_parser.rb +0 -20
- data/spec/parser_factory_spec.rb +0 -17
- data/spec/parsers/csslint_parser_spec.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8287c5c0e4f9bff0339747780e6703edb34da094
|
4
|
+
data.tar.gz: daa63c1ff3d6f0f7326a55f8765e7590df580457
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c69ff6525a32dc8b10623f24e32b0df1e2d5d333135671f4b81a27346ca6d0f72b973b2c9c33d8cf6fdf67281deb68ecbc54a3c9c158d6bd20491e2655765205
|
7
|
+
data.tar.gz: 8ac69d234efc1567d9b3e5cac17c064baffccb8cc4bdc570e1c03f460506f9622baf2156d269ab32c0c3597107a619735c67e508cb71c021a2fe30ab4ac56a8b
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
# Common configuration.
|
2
|
+
AllCops:
|
3
|
+
# Include gemspec and Rakefile
|
4
|
+
Include:
|
5
|
+
- '**/*.gemspec'
|
6
|
+
- '**/Rakefile'
|
7
|
+
- '**/*.rake'
|
8
|
+
- '**/Gemfile'
|
9
|
+
Exclude:
|
10
|
+
- 'vendor/**'
|
11
|
+
- 'spec/fixtures/**'
|
12
|
+
RunRailsCops: true
|
13
|
+
|
14
|
+
# Indent private/protected/public as deep as method definitions
|
15
|
+
AccessModifierIndentation:
|
16
|
+
EnforcedStyle: outdent
|
17
|
+
SupportedStyles:
|
18
|
+
- outdent
|
19
|
+
- indent
|
20
|
+
|
21
|
+
# Indentation of `when`.
|
22
|
+
CaseIndentation:
|
23
|
+
IndentWhenRelativeTo: end
|
24
|
+
SupportedStyles:
|
25
|
+
- case
|
26
|
+
- end
|
27
|
+
IndentOneStep: false
|
28
|
+
|
29
|
+
ClassLength:
|
30
|
+
CountComments: false # count full line comments?
|
31
|
+
Max: 200
|
32
|
+
|
33
|
+
# Align ends correctly.
|
34
|
+
EndAlignment:
|
35
|
+
# The value `keyword` means that `end` should be aligned with the matching
|
36
|
+
# keyword (if, while, etc.).
|
37
|
+
# The value `variable` means that in assignments, `end` should be aligned
|
38
|
+
# with the start of the variable on the left hand side of `=`. In all other
|
39
|
+
# situations, `end` should still be aligned with the keyword.
|
40
|
+
AlignWith: variable
|
41
|
+
SupportedStyles:
|
42
|
+
- keyword
|
43
|
+
- variable
|
44
|
+
|
45
|
+
# Built-in global variables are allowed by default.
|
46
|
+
GlobalVars:
|
47
|
+
AllowedVariables: ['$1', '$2', '$3', '$4', '$5', '$6']
|
48
|
+
|
49
|
+
LineLength:
|
50
|
+
Max: 120
|
51
|
+
|
52
|
+
MethodLength:
|
53
|
+
CountComments: false # count full line comments?
|
54
|
+
Max: 20
|
55
|
+
|
56
|
+
NumericLiterals:
|
57
|
+
MinDigits: 10
|
58
|
+
|
59
|
+
SignalException:
|
60
|
+
EnforcedStyle: only_raise
|
61
|
+
SupportedStyles:
|
62
|
+
- only_raise
|
63
|
+
- only_fail
|
64
|
+
- semantic
|
65
|
+
|
66
|
+
SpaceBeforeBlockBraces:
|
67
|
+
EnforcedStyle: no_space
|
68
|
+
SupportedStyles:
|
69
|
+
- space
|
70
|
+
- no_space
|
71
|
+
|
72
|
+
SpaceInsideBlockBraces:
|
73
|
+
EnforcedStyle: no_space
|
74
|
+
SupportedStyles:
|
75
|
+
- space
|
76
|
+
- no_space
|
77
|
+
# Valid values are: space, no_space
|
78
|
+
EnforcedStyleForEmptyBraces: no_space
|
79
|
+
# Space between { and |. Overrides EnforcedStyle if there is a conflict.
|
80
|
+
SpaceBeforeBlockParameters: false
|
81
|
+
|
82
|
+
SpaceInsideHashLiteralBraces:
|
83
|
+
EnforcedStyle: no_space
|
84
|
+
EnforcedStyleForEmptyBraces: no_space
|
85
|
+
SupportedStyles:
|
86
|
+
- space
|
87
|
+
- no_space
|
88
|
+
|
89
|
+
# Checks whether the source file has a utf-8 encoding comment or not
|
90
|
+
Encoding:
|
91
|
+
EnforcedStyle: when_needed
|
92
|
+
SupportedStyles:
|
93
|
+
- when_needed
|
94
|
+
- always
|
95
|
+
|
96
|
+
WordArray:
|
97
|
+
MinSize: 0
|
data/Dockerfile
ADDED
@@ -0,0 +1,222 @@
|
|
1
|
+
FROM ubuntu:trusty
|
2
|
+
MAINTAINER Allen Madsen
|
3
|
+
|
4
|
+
###### Create user
|
5
|
+
ENV user spin_cycle
|
6
|
+
ENV group linters
|
7
|
+
ENV homedir /home/spin_cycle
|
8
|
+
|
9
|
+
RUN mkdir -p $homedir && \
|
10
|
+
groupadd -r $group -g 777 && \
|
11
|
+
useradd -u 666 -r -g $group -d $homedir -s /sbin/nologin -c "Docker image user" $user && \
|
12
|
+
chown -R $user:$group $homedir
|
13
|
+
|
14
|
+
###### Packages
|
15
|
+
USER root
|
16
|
+
|
17
|
+
RUN apt-get update && apt-get install -y \
|
18
|
+
bzr \
|
19
|
+
cvs \
|
20
|
+
git \
|
21
|
+
mercurial \
|
22
|
+
subversion \
|
23
|
+
&& rm -rf /var/lib/apt/lists/*
|
24
|
+
|
25
|
+
RUN apt-get update && apt-get install -y \
|
26
|
+
curl \
|
27
|
+
wget \
|
28
|
+
&& rm -rf /var/lib/apt/lists/*
|
29
|
+
|
30
|
+
RUN apt-get update && apt-get install -y \
|
31
|
+
autoconf \
|
32
|
+
build-essential \
|
33
|
+
imagemagick \
|
34
|
+
libbz2-dev \
|
35
|
+
libcurl4-openssl-dev \
|
36
|
+
libevent-dev \
|
37
|
+
libffi-dev \
|
38
|
+
libglib2.0-dev \
|
39
|
+
libjpeg-dev \
|
40
|
+
libmagickcore-dev \
|
41
|
+
libmagickwand-dev \
|
42
|
+
libmysqlclient-dev \
|
43
|
+
libncurses-dev \
|
44
|
+
libpq-dev \
|
45
|
+
libreadline-dev \
|
46
|
+
libsqlite3-dev \
|
47
|
+
libssl-dev \
|
48
|
+
libxml2-dev \
|
49
|
+
libxslt-dev \
|
50
|
+
libyaml-dev \
|
51
|
+
zlib1g-dev \
|
52
|
+
&& rm -rf /var/lib/apt/lists/*
|
53
|
+
|
54
|
+
###### Languages
|
55
|
+
|
56
|
+
### Node.js
|
57
|
+
RUN apt-get update && apt-get install -y \
|
58
|
+
ca-certificates \
|
59
|
+
&& rm -rf /var/lib/apt/lists/*
|
60
|
+
|
61
|
+
# verify gpg and sha256: http://nodejs.org/dist/v0.10.31/SHASUMS256.txt.asc
|
62
|
+
# gpg: aka "Timothy J Fontaine (Work) <tj.fontaine@joyent.com>"
|
63
|
+
RUN gpg --keyserver pgp.mit.edu --recv-keys 7937DFD2AB06298B2293C3187D33FF9D0246406D
|
64
|
+
|
65
|
+
ENV NODE_VERSION 0.10.35
|
66
|
+
ENV NPM_VERSION 2.1.16
|
67
|
+
|
68
|
+
RUN curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \
|
69
|
+
&& curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
|
70
|
+
&& gpg --verify SHASUMS256.txt.asc \
|
71
|
+
&& grep " node-v$NODE_VERSION-linux-x64.tar.gz\$" SHASUMS256.txt.asc | sha256sum -c - \
|
72
|
+
&& tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 \
|
73
|
+
&& rm "node-v$NODE_VERSION-linux-x64.tar.gz" SHASUMS256.txt.asc \
|
74
|
+
&& npm install -g npm@"$NPM_VERSION" \
|
75
|
+
&& npm cache clear
|
76
|
+
|
77
|
+
### Ruby
|
78
|
+
RUN apt-get update && apt-get install -y \
|
79
|
+
curl \
|
80
|
+
procps \
|
81
|
+
&& rm -rf /var/lib/apt/lists/*
|
82
|
+
|
83
|
+
ENV RUBY_MAJOR 2.2
|
84
|
+
ENV RUBY_VERSION 2.2.0
|
85
|
+
|
86
|
+
# some of ruby's build scripts are written in ruby
|
87
|
+
# we purge this later to make sure our final image uses what we just built
|
88
|
+
RUN apt-get update \
|
89
|
+
&& apt-get install -y bison ruby \
|
90
|
+
&& rm -rf /var/lib/apt/lists/* \
|
91
|
+
&& mkdir -p /usr/src/ruby \
|
92
|
+
&& curl -SL "http://cache.ruby-lang.org/pub/ruby/$RUBY_MAJOR/ruby-$RUBY_VERSION.tar.bz2" \
|
93
|
+
| tar -xjC /usr/src/ruby --strip-components=1 \
|
94
|
+
&& cd /usr/src/ruby \
|
95
|
+
&& autoconf \
|
96
|
+
&& ./configure --disable-install-doc \
|
97
|
+
&& make -j"$(nproc)" \
|
98
|
+
&& apt-get purge -y --auto-remove bison ruby \
|
99
|
+
&& make install \
|
100
|
+
&& rm -r /usr/src/ruby
|
101
|
+
|
102
|
+
# skip installing gem documentation
|
103
|
+
RUN echo 'gem: --no-rdoc --no-ri' >> "$HOME/.gemrc"
|
104
|
+
|
105
|
+
### Java
|
106
|
+
ENV JAVA_VERSION 7u71
|
107
|
+
ENV JAVA_DEBIAN_VERSION 7u71-2.5.3-0ubuntu0.14.04.1
|
108
|
+
|
109
|
+
RUN apt-get update \
|
110
|
+
&& apt-get install -y \
|
111
|
+
curl \
|
112
|
+
openjdk-7-jre-headless="$JAVA_DEBIAN_VERSION" \
|
113
|
+
unzip \
|
114
|
+
wget \
|
115
|
+
&& rm -rf /var/lib/apt/lists/*
|
116
|
+
|
117
|
+
|
118
|
+
### Go
|
119
|
+
# SCMs for "go get", gcc for cgo
|
120
|
+
RUN apt-get update && apt-get install -y \
|
121
|
+
ca-certificates \
|
122
|
+
curl \
|
123
|
+
gcc \
|
124
|
+
libc6-dev \
|
125
|
+
make \
|
126
|
+
bzr \
|
127
|
+
git \
|
128
|
+
mercurial \
|
129
|
+
--no-install-recommends \
|
130
|
+
&& rm -rf /var/lib/apt/lists/*
|
131
|
+
|
132
|
+
ENV GOLANG_VERSION 1.4
|
133
|
+
|
134
|
+
RUN curl -sSL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz | tar -v -C /usr/src -xz \
|
135
|
+
&& cd /usr/src/go/src \
|
136
|
+
&& ./make.bash --no-clean 2>&1
|
137
|
+
|
138
|
+
ENV PATH /usr/src/go/bin:$PATH
|
139
|
+
|
140
|
+
RUN mkdir -p /go/src
|
141
|
+
ENV GOPATH /go
|
142
|
+
ENV PATH /go/bin:$PATH
|
143
|
+
|
144
|
+
### Python
|
145
|
+
# remove several traces of debian python
|
146
|
+
RUN apt-get purge -y python.*
|
147
|
+
|
148
|
+
# http://bugs.python.org/issue19846
|
149
|
+
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
|
150
|
+
ENV LANG C.UTF-8
|
151
|
+
|
152
|
+
ENV PYTHON_VERSION 2.7.9
|
153
|
+
|
154
|
+
RUN set -x \
|
155
|
+
&& mkdir -p /usr/src/python \
|
156
|
+
&& curl -SL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" \
|
157
|
+
| tar -xJC /usr/src/python --strip-components=1 \
|
158
|
+
&& cd /usr/src/python \
|
159
|
+
&& ./configure --enable-shared \
|
160
|
+
&& make -j$(nproc) \
|
161
|
+
&& make install \
|
162
|
+
&& ldconfig \
|
163
|
+
&& curl -SL 'https://bootstrap.pypa.io/get-pip.py' | python2 \
|
164
|
+
&& find /usr/local \
|
165
|
+
\( -type d -a -name test -o -name tests \) \
|
166
|
+
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
|
167
|
+
-exec rm -rf '{}' + \
|
168
|
+
&& rm -rf /usr/src/python
|
169
|
+
|
170
|
+
###### Linters
|
171
|
+
|
172
|
+
### CPPCheck
|
173
|
+
ENV CPPCHECK_VERSION 1.61-1
|
174
|
+
|
175
|
+
RUN apt-get update && apt-get install -y \
|
176
|
+
cppcheck=$CPPCHECK_VERSION \
|
177
|
+
&& rm -rf /var/lib/apt/lists/*
|
178
|
+
|
179
|
+
### GoLint
|
180
|
+
RUN go get github.com/golang/lint/golint
|
181
|
+
|
182
|
+
### JSHint, CSSLint, JSONLint, CoffeeLint
|
183
|
+
ENV JSHINT_VERSION 2.5.11
|
184
|
+
ENV CSSLINT_VERSION 0.10.0
|
185
|
+
ENV JSONLINT_VERSION 0.0.4
|
186
|
+
ENV COFFEELINT_VERSION 1.8.1
|
187
|
+
|
188
|
+
RUN npm install -g \
|
189
|
+
jshint@$JSHINT_VERSION \
|
190
|
+
csslint@$CSSLINT_VERSION \
|
191
|
+
durable-json-lint-cli@$JSONLINT_VERSION \
|
192
|
+
coffeelint@$COFFEELINT_VERSION
|
193
|
+
|
194
|
+
### PyLint
|
195
|
+
ENV PYLINT_VERSION 1.4.0
|
196
|
+
|
197
|
+
RUN pip install pylint==$PYLINT_VERSION
|
198
|
+
|
199
|
+
### RuboCop, SCSSLint
|
200
|
+
ENV RUBOCOP_VERSION 0.28.0
|
201
|
+
ENV SCSSLINT_VERSION 0.32.0
|
202
|
+
|
203
|
+
RUN gem install rubocop:$RUBOCOP_VERSION scss-lint:$SCSSLINT_VERSION
|
204
|
+
|
205
|
+
###### Display Versions
|
206
|
+
RUN echo 'CPPCheck' && cppcheck --version && echo \
|
207
|
+
&& echo 'Go' && go version && echo \
|
208
|
+
&& echo 'GoLint' && which golint && echo \
|
209
|
+
&& echo 'Java' && java -version && echo \
|
210
|
+
&& echo 'JavaScript' && node --version && echo \
|
211
|
+
&& echo 'JSHint' && jshint --version && echo \
|
212
|
+
&& echo 'CSSLint' && csslint --version && echo \
|
213
|
+
&& echo 'JSONLint' && durable-json-lint --version && echo \
|
214
|
+
&& echo 'Python' && python --version && echo \
|
215
|
+
&& echo 'PyLint' && pylint --version && echo \
|
216
|
+
&& echo 'Ruby' && ruby --version && echo \
|
217
|
+
&& echo 'RuboCop' && rubocop --version && echo \
|
218
|
+
&& echo 'SCSSLint' && scss-lint --version && echo
|
219
|
+
|
220
|
+
###### Finally
|
221
|
+
USER $user
|
222
|
+
WORKDIR $homedir
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,7 +1,52 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rspec/core/rake_task"
|
3
3
|
|
4
|
+
$stdout.sync = true
|
5
|
+
|
4
6
|
RSpec::Core::RakeTask.new(:spec)
|
5
7
|
|
6
8
|
task :default => :spec
|
7
9
|
|
10
|
+
task :credentials do
|
11
|
+
require 'fileutils'
|
12
|
+
|
13
|
+
credentials = "---\n:rubygems_api_key: #{ENV['RUBYGEMS_API_KEY']}\n"
|
14
|
+
credentials_path = File.expand_path('~') + '/.gem/credentials'
|
15
|
+
|
16
|
+
FileUtils.mkdir_p('~/.gem')
|
17
|
+
File.write(credentials_path, credentials)
|
18
|
+
FileUtils.chmod(0600, credentials_path)
|
19
|
+
end
|
20
|
+
|
21
|
+
namespace :docker do
|
22
|
+
DockerError = Class.new(StandardError)
|
23
|
+
|
24
|
+
def fail_on_error
|
25
|
+
return if $? == 0
|
26
|
+
|
27
|
+
raise DockerError, 'There was a problem executing the command.'
|
28
|
+
end
|
29
|
+
|
30
|
+
def sha
|
31
|
+
ENV['CIRCLE_SHA1'] ? ENV['CIRCLE_SHA1'] : ENV['SHA']
|
32
|
+
end
|
33
|
+
|
34
|
+
task :tag do
|
35
|
+
require_relative 'lib/lint_trap/version'
|
36
|
+
|
37
|
+
system("docker tag -f lintci/spin_cycle:#{sha} lintci/spin_cycle:latest") and fail_on_error
|
38
|
+
system("docker tag -f lintci/spin_cycle:#{sha} lintci/spin_cycle:#{LintTrap::VERSION}") and fail_on_error
|
39
|
+
end
|
40
|
+
|
41
|
+
task :build do
|
42
|
+
system("docker pull lintci/spin_cycle:latest") and fail_on_error
|
43
|
+
system("docker build -t lintci/spin_cycle:#{sha} .") and fail_on_error
|
44
|
+
end
|
45
|
+
|
46
|
+
task :push do
|
47
|
+
system("docker login -e #{ENV['DOCKER_EMAIL']} -u #{ENV['DOCKER_USER']} -p #{ENV['DOCKER_PASSWORD']}") and fail_on_error
|
48
|
+
system("docker push lintci/spin_cycle:#{sha}")
|
49
|
+
system("docker push lintci/spin_cycle:#{LintTrap::VERSION}")
|
50
|
+
system("docker push lintci/spin_cycle:latest")
|
51
|
+
end
|
52
|
+
end
|
data/circle.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
machine:
|
2
|
+
services:
|
3
|
+
- docker
|
4
|
+
environment:
|
5
|
+
# DEBUG_LINTING: true
|
6
|
+
checkout:
|
7
|
+
pre:
|
8
|
+
- git config --global user.email "circleci@lintci.com"
|
9
|
+
- git config --global user.name "LintCI's CircleCI Bot"
|
10
|
+
dependencies:
|
11
|
+
post:
|
12
|
+
- bundle exec rake docker:build docker:tag
|
13
|
+
deployment:
|
14
|
+
rubygems:
|
15
|
+
branch: master
|
16
|
+
commands:
|
17
|
+
- bundle exec rake credentials release
|
18
|
+
dockerhub:
|
19
|
+
branch: master
|
20
|
+
commands:
|
21
|
+
- bundle exec rake docker:push
|
22
|
+
|
Binary file
|
@@ -0,0 +1,177 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<!DOCTYPE module PUBLIC
|
3
|
+
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
4
|
+
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
|
5
|
+
|
6
|
+
<!--
|
7
|
+
|
8
|
+
Checkstyle configuration that checks the sun coding conventions from:
|
9
|
+
|
10
|
+
- the Java Language Specification at
|
11
|
+
http://java.sun.com/docs/books/jls/second_edition/html/index.html
|
12
|
+
|
13
|
+
- the Sun Code Conventions at http://java.sun.com/docs/codeconv/
|
14
|
+
|
15
|
+
- the Javadoc guidelines at
|
16
|
+
http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
|
17
|
+
|
18
|
+
- the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
|
19
|
+
|
20
|
+
- some best practices
|
21
|
+
|
22
|
+
Checkstyle is very configurable. Be sure to read the documentation at
|
23
|
+
http://checkstyle.sf.net (or in your downloaded distribution).
|
24
|
+
|
25
|
+
Most Checks are configurable, be sure to consult the documentation.
|
26
|
+
|
27
|
+
To completely disable a check, just comment it out or delete it from the file.
|
28
|
+
|
29
|
+
Finally, it is worth reading the documentation.
|
30
|
+
|
31
|
+
-->
|
32
|
+
|
33
|
+
<module name="Checker">
|
34
|
+
<!--
|
35
|
+
If you set the basedir property below, then all reported file
|
36
|
+
names will be relative to the specified directory. See
|
37
|
+
http://checkstyle.sourceforge.net/5.x/config.html#Checker
|
38
|
+
|
39
|
+
<property name="basedir" value="${basedir}"/>
|
40
|
+
-->
|
41
|
+
|
42
|
+
<!-- Checks that a package-info.java file exists for each package. -->
|
43
|
+
<!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
|
44
|
+
<!-- <module name="JavadocPackage"/> -->
|
45
|
+
|
46
|
+
<!-- Checks whether files end with a new line. -->
|
47
|
+
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
|
48
|
+
<module name="NewlineAtEndOfFile"/>
|
49
|
+
|
50
|
+
<!-- Checks that property files contain the same keys. -->
|
51
|
+
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
|
52
|
+
<module name="Translation"/>
|
53
|
+
|
54
|
+
<!-- Checks for Size Violations. -->
|
55
|
+
<!-- See http://checkstyle.sf.net/config_sizes.html -->
|
56
|
+
<module name="FileLength"/>
|
57
|
+
|
58
|
+
<!-- Checks for whitespace -->
|
59
|
+
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
|
60
|
+
<module name="FileTabCharacter"/>
|
61
|
+
|
62
|
+
<!-- Miscellaneous other checks. -->
|
63
|
+
<!-- See http://checkstyle.sf.net/config_misc.html -->
|
64
|
+
<module name="RegexpSingleline">
|
65
|
+
<property name="format" value="\s+$"/>
|
66
|
+
<property name="minimum" value="0"/>
|
67
|
+
<property name="maximum" value="0"/>
|
68
|
+
<property name="message" value="Line has trailing spaces."/>
|
69
|
+
</module>
|
70
|
+
|
71
|
+
<!-- Checks for Headers -->
|
72
|
+
<!-- See http://checkstyle.sf.net/config_header.html -->
|
73
|
+
<!-- <module name="Header"> -->
|
74
|
+
<!-- <property name="headerFile" value="${checkstyle.header.file}"/> -->
|
75
|
+
<!-- <property name="fileExtensions" value="java"/> -->
|
76
|
+
<!-- </module> -->
|
77
|
+
|
78
|
+
<module name="TreeWalker">
|
79
|
+
|
80
|
+
<!-- Checks for Javadoc comments. -->
|
81
|
+
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
|
82
|
+
<module name="JavadocMethod"/>
|
83
|
+
<module name="JavadocType"/>
|
84
|
+
<module name="JavadocVariable"/>
|
85
|
+
<module name="JavadocStyle"/>
|
86
|
+
|
87
|
+
|
88
|
+
<!-- Checks for Naming Conventions. -->
|
89
|
+
<!-- See http://checkstyle.sf.net/config_naming.html -->
|
90
|
+
<module name="ConstantName"/>
|
91
|
+
<module name="LocalFinalVariableName"/>
|
92
|
+
<module name="LocalVariableName"/>
|
93
|
+
<module name="MemberName"/>
|
94
|
+
<module name="MethodName"/>
|
95
|
+
<module name="PackageName"/>
|
96
|
+
<module name="ParameterName"/>
|
97
|
+
<module name="StaticVariableName"/>
|
98
|
+
<module name="TypeName"/>
|
99
|
+
|
100
|
+
|
101
|
+
<!-- Checks for imports -->
|
102
|
+
<!-- See http://checkstyle.sf.net/config_import.html -->
|
103
|
+
<module name="AvoidStarImport"/>
|
104
|
+
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
|
105
|
+
<module name="RedundantImport"/>
|
106
|
+
<module name="UnusedImports"/>
|
107
|
+
|
108
|
+
|
109
|
+
<!-- Checks for Size Violations. -->
|
110
|
+
<!-- See http://checkstyle.sf.net/config_sizes.html -->
|
111
|
+
<module name="LineLength"/>
|
112
|
+
<module name="MethodLength"/>
|
113
|
+
<module name="ParameterNumber"/>
|
114
|
+
|
115
|
+
|
116
|
+
<!-- Checks for whitespace -->
|
117
|
+
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
|
118
|
+
<module name="EmptyForIteratorPad"/>
|
119
|
+
<module name="GenericWhitespace"/>
|
120
|
+
<module name="MethodParamPad"/>
|
121
|
+
<module name="NoWhitespaceAfter"/>
|
122
|
+
<module name="NoWhitespaceBefore"/>
|
123
|
+
<module name="OperatorWrap"/>
|
124
|
+
<module name="ParenPad"/>
|
125
|
+
<module name="TypecastParenPad"/>
|
126
|
+
<module name="WhitespaceAfter"/>
|
127
|
+
<module name="WhitespaceAround"/>
|
128
|
+
|
129
|
+
|
130
|
+
<!-- Modifier Checks -->
|
131
|
+
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
|
132
|
+
<module name="ModifierOrder"/>
|
133
|
+
<module name="RedundantModifier"/>
|
134
|
+
|
135
|
+
|
136
|
+
<!-- Checks for blocks. You know, those {}'s -->
|
137
|
+
<!-- See http://checkstyle.sf.net/config_blocks.html -->
|
138
|
+
<module name="AvoidNestedBlocks"/>
|
139
|
+
<module name="EmptyBlock"/>
|
140
|
+
<module name="LeftCurly"/>
|
141
|
+
<module name="NeedBraces"/>
|
142
|
+
<module name="RightCurly"/>
|
143
|
+
|
144
|
+
|
145
|
+
<!-- Checks for common coding problems -->
|
146
|
+
<!-- See http://checkstyle.sf.net/config_coding.html -->
|
147
|
+
<module name="AvoidInlineConditionals"/>
|
148
|
+
<module name="EmptyStatement"/>
|
149
|
+
<module name="EqualsHashCode"/>
|
150
|
+
<module name="HiddenField"/>
|
151
|
+
<module name="IllegalInstantiation"/>
|
152
|
+
<module name="InnerAssignment"/>
|
153
|
+
<module name="MagicNumber"/>
|
154
|
+
<module name="MissingSwitchDefault"/>
|
155
|
+
<module name="RedundantThrows"/>
|
156
|
+
<module name="SimplifyBooleanExpression"/>
|
157
|
+
<module name="SimplifyBooleanReturn"/>
|
158
|
+
|
159
|
+
<!-- Checks for class design -->
|
160
|
+
<!-- See http://checkstyle.sf.net/config_design.html -->
|
161
|
+
<module name="DesignForExtension"/>
|
162
|
+
<module name="FinalClass"/>
|
163
|
+
<module name="HideUtilityClassConstructor"/>
|
164
|
+
<module name="InterfaceIsType"/>
|
165
|
+
<module name="VisibilityModifier"/>
|
166
|
+
|
167
|
+
|
168
|
+
<!-- Miscellaneous other checks. -->
|
169
|
+
<!-- See http://checkstyle.sf.net/config_misc.html -->
|
170
|
+
<module name="ArrayTypeStyle"/>
|
171
|
+
<module name="FinalParameters"/>
|
172
|
+
<module name="TodoComment"/>
|
173
|
+
<module name="UpperEll"/>
|
174
|
+
|
175
|
+
</module>
|
176
|
+
|
177
|
+
</module>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module.exports = class LintTrap
|
2
|
+
constructor: (@errorReport, options = {}) ->
|
3
|
+
|
4
|
+
publish: ->
|
5
|
+
for file, errors of @errorReport.paths
|
6
|
+
for error in errors
|
7
|
+
line = error.lineNumber
|
8
|
+
rule = error.rule
|
9
|
+
severity = error.level
|
10
|
+
message = error.message
|
11
|
+
|
12
|
+
console.log("#{file}:#{line}:::#{rule}:#{severity}:#{message}")
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module.exports = {
|
2
|
+
reporter: function (results, data, opts) {
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
results.forEach(function (result) {
|
6
|
+
var file = result.file,
|
7
|
+
error = result.error,
|
8
|
+
line = error.line,
|
9
|
+
column = error.character,
|
10
|
+
rule = error.code,
|
11
|
+
severity = rule[0] === 'E' ? 'error' : 'warning',
|
12
|
+
message = error.reason;
|
13
|
+
|
14
|
+
console.log(file + ':' +
|
15
|
+
line + ':' +
|
16
|
+
column + '::' +
|
17
|
+
rule + ':' +
|
18
|
+
severity + ':' +
|
19
|
+
message);
|
20
|
+
});
|
21
|
+
}
|
22
|
+
};
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module LintTrap
|
2
|
+
class Rubocop
|
3
|
+
# Formats Rubocop output for LintTrap
|
4
|
+
class Formatter < ::RuboCop::Formatter::BaseFormatter
|
5
|
+
LINE_FORMAT = "%s:%d:%d:%d:%s:%s:%s\n"
|
6
|
+
|
7
|
+
def file_finished(file, offenses)
|
8
|
+
offenses.each do |offense|
|
9
|
+
line = offense.line
|
10
|
+
column = offense.real_column
|
11
|
+
length = offense.location.length
|
12
|
+
|
13
|
+
rule = offense.cop_name
|
14
|
+
severity = offense.severity.name
|
15
|
+
message = offense.message
|
16
|
+
|
17
|
+
output.printf(LINE_FORMAT, file, line, column, length, rule, severity, message)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'scss_lint'
|
4
|
+
require 'scss_lint/cli'
|
5
|
+
|
6
|
+
module SCSSLint
|
7
|
+
class Reporter
|
8
|
+
# Formats SCSS Lint output for LintTrap
|
9
|
+
class LintTrapReporter < Reporter
|
10
|
+
LINE_FORMAT = "%s:%d:%d:%d:%s:%s:%s\n"
|
11
|
+
|
12
|
+
def report_lints
|
13
|
+
return unless lints.any?
|
14
|
+
|
15
|
+
lints.map{|lint| LINE_FORMAT % variables(lint)}.join('')
|
16
|
+
end
|
17
|
+
|
18
|
+
def variables(lint)
|
19
|
+
file = lint.filename
|
20
|
+
line = lint.location.line
|
21
|
+
column = lint.location.column
|
22
|
+
length = lint.location.length
|
23
|
+
|
24
|
+
rule = lint.linter ? lint.linter.name : ''
|
25
|
+
severity = lint.severity.to_s
|
26
|
+
message = lint.description
|
27
|
+
|
28
|
+
[file, line, column, length, rule, severity, message]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
exit SCSSLint::CLI.new.run(ARGV)
|