Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 90761f0

Browse files
authored
Merge pull request #39 from codeclimate/node
2.0: Rewrite in JavaScript
2 parents 8f3aed0 + 5899409 commit 90761f0

27 files changed

+828
-403
lines changed

.codeclimate.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
engines:
2-
rubocop:
2+
eslint:
33
enabled: true
4-
ratings:
5-
paths:
6-
- "**.rb"
4+
channel: eslint-4
75
exclude_paths:
8-
- spec/**/*
6+
- test/**/*
7+
- node_modules/**/*

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.git
22
Makefile
3+
node_modules

.eslintrc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"env": {
3+
"node": true,
4+
"mocha": true,
5+
"es6": true
6+
},
7+
"rules": {
8+
"block-spacing": 2,
9+
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
10+
"comma-dangle": [2, "never"],
11+
"comma-style": [2, "first", { exceptions: {ArrayExpression: true, ObjectExpression: true} }],
12+
"complexity": [2, 6],
13+
"curly": 2,
14+
"eqeqeq": [2, "allow-null"],
15+
"max-statements": [2, 30],
16+
"no-shadow-restricted-names": 2,
17+
"no-undef": 2,
18+
"no-use-before-define": 2,
19+
"radix": 2,
20+
"semi": 2,
21+
"space-infix-ops": 2,
22+
"strict": 0
23+
},
24+
"globals": {
25+
"AnalysisView": true,
26+
"PollingView": true,
27+
"Prism": true,
28+
"Spinner": true,
29+
"Timer": true,
30+
"moment": true
31+
}
32+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

.rubocop.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.ruby-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

Dockerfile

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
1-
FROM codeclimate/alpine-ruby:b38
1+
FROM node:alpine
2+
LABEL maintainer="Code Climate <hello@codeclimate.com>"
3+
4+
RUN adduser -u 9000 -D app
25

36
WORKDIR /usr/src/app
4-
COPY Gemfile /usr/src/app/
5-
COPY Gemfile.lock /usr/src/app/
67

7-
RUN apk --update add nodejs git zlib zlib-dev ruby ruby-dev ruby-bundler less build-base && \
8-
bundle install -j 4 && \
9-
apk del --purge build-base zlib zlib-dev && rm -fr /usr/share/ri
8+
COPY package.json yarn.lock engine.json ./
109

11-
ENV CSSLINT_SHA=87aa604a4cbc5125db979576f1b09b35980fcf08
12-
RUN npm install -g codeclimate/csslint.git#$CSSLINT_SHA
10+
RUN yarn install && \
11+
chown -R app:app ./ && \
12+
apk add --no-cache --virtual .dev-deps jq && \
13+
export csslint_version=$(yarn --json list --pattern csslint 2>/dev/null | jq -r '.data.trees[0].name' | cut -d@ -f2) && \
14+
cat engine.json | jq '.version = .version + "/" + env.csslint_version' > /engine.json && \
15+
apk del .dev-deps
1316

14-
RUN adduser -u 9000 -D app
15-
USER app
17+
COPY . ./
1618

1719
COPY . /usr/src/app
1820

21+
USER app
22+
23+
VOLUME /code
24+
WORKDIR /code
25+
1926
CMD ["/usr/src/app/bin/csslint"]

Gemfile

Lines changed: 0 additions & 10 deletions
This file was deleted.

Gemfile.lock

Lines changed: 0 additions & 44 deletions
This file was deleted.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ image:
44
docker build -t codeclimate/codeclimate-csslint .
55

66
test: image
7-
docker run --rm codeclimate/codeclimate-csslint rspec $(RSPEC_ARGS)
7+
docker run --rm codeclimate/codeclimate-csslint sh -c "cd /usr/src/app && npm run test"

Rakefile

Lines changed: 0 additions & 5 deletions
This file was deleted.

bin/csslint

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
#!/usr/bin/env ruby
2-
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), "../lib")))
1+
#!/usr/local/bin/node --expose-gc
32

4-
require 'cc/engine/csslint'
3+
const fs = require("fs");
4+
const Engine = require("../lib/csslint");
55

6-
if File.exists?("/config.json")
7-
engine_config = JSON.parse(File.read("/config.json"))
8-
else
9-
engine_config = {}
10-
end
6+
const CONFIG_PATH = "/config.json";
7+
let config = JSON.parse(fs.readFileSync(CONFIG_PATH));
118

12-
CC::Engine::CSSlint.new(
13-
directory: "/code", engine_config: engine_config, io: STDOUT
14-
).run
9+
const CODE_DIR = "/code";
10+
new Engine(CODE_DIR, console, config).run();

bin/csslint.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env ruby
2+
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), "../lib")))
3+
4+
require 'cc/engine/csslint'
5+
6+
if File.exists?("/config.json")
7+
engine_config = JSON.parse(File.read("/config.json"))
8+
else
9+
engine_config = {}
10+
end
11+
12+
CC::Engine::CSSlint.new(
13+
directory: "/code", engine_config: engine_config, io: STDOUT
14+
).run

engine.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "CSSLint",
3+
"description": "CSSLint is a tool to help point out problems with your CSS code.",
4+
"maintainer": {
5+
"name": "Code Climate",
6+
"email": "hello@codeclimate.com"
7+
},
8+
"languages": [
9+
"CSS"
10+
],
11+
"version": "2.0.0",
12+
"spec_version": "0.3.1"
13+
}

lib/cc/engine/csslint.rb

Lines changed: 0 additions & 92 deletions
This file was deleted.

lib/cc/engine/csslint/check_details.rb

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)