Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM ruby:2.3-slim

WORKDIR /usr/src/app
COPY Gemfile /usr/src/app/
COPY Gemfile.lock /usr/src/app/

RUN apt-get update && apt-get install -y \
build-essential && \
bundle install && \
rm -rf /var/lib/apt/lists/* && \
apt-get remove -y build-essential && \
apt-get autoremove -y

RUN adduser \
--uid 9000 \
--home /home/app \
--disabled-password \
--gecos "" app

COPY doc/rules.yml /rules.yml

COPY bin /usr/src/app/bin
COPY lib /usr/src/app/lib
RUN chown -R app:app /usr/src/app

USER app
VOLUME /code
WORKDIR /code

CMD ["/usr/src/app/bin/codeclimate-foodcritic"]
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source "https://rubygems.org"

gem "foodcritic", "~> 6.0"

group :test do
gem "rspec"
end
48 changes: 48 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.2.5)
erubis (2.7.0)
foodcritic (6.0.1)
erubis
gherkin (~> 2.11)
nokogiri (>= 1.5, < 2.0)
rake
rufus-lru (~> 1.0)
treetop (~> 1.4)
yajl-ruby (~> 1.1)
gherkin (2.12.2)
multi_json (~> 1.3)
mini_portile2 (2.0.0)
multi_json (1.11.2)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
polyglot (0.3.5)
rake (10.5.0)
rspec (3.4.0)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
rspec-core (3.4.3)
rspec-support (~> 3.4.0)
rspec-expectations (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-mocks (3.4.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-support (3.4.1)
rufus-lru (1.0.5)
treetop (1.6.5)
polyglot (~> 0.3)
yajl-ruby (1.2.1)

PLATFORMS
ruby

DEPENDENCIES
foodcritic (~> 6.0)
rspec

BUNDLED WITH
1.10.6
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.PHONY: image

IMAGE_NAME ?= codeclimate/codeclimate-foodcritic

image:
docker build --tag $(IMAGE_NAME) .

citest:
docker run --rm \
--volume $(PWD)/spec:/usr/src/app/spec \
--workdir /usr/src/app $(IMAGE_NAME) rspec

test: image citest
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Code Climate Engine to run [Foodcritic][]

[foodcritic]: http://www.foodcritic.io/

## Usage

**.codeclimate.yml**

```yml
engines:
foodcritic:
enabled: true
```

## Configuration

This engine accepts `tags` and `cookbook_paths` in its configuration. Both
values are optional:

```yml
engines:
foodcritic:
enabled: true
config:
tags:
- "~FC011"
- "~FC033"
cookbook_paths:
- libraries/mysql.rb
- libraries/docker.rb
```

**NOTE**: `cookbook_paths`, when defined, are passed directly to Foodcritic and
any computed `include_paths` (which take into account your configured
`exclude_paths`) are ignored.
12 changes: 12 additions & 0 deletions bin/codeclimate-foodcritic
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env ruby
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), "../lib")))

require "cc/engine"

CC::Engine.each_issue do |issue|
if File.exist?(issue.filename)
print "#{issue.to_json}\0"
else
$stderr.puts "Omitting issue for non-existent file: #{issue.filename}"
end
end
11 changes: 11 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
machine:
services:
- docker

dependencies:
override:
- make image

test:
override:
- make citest
Loading