Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce HAML-Lint for HAML files #776

Merged
merged 1 commit into from
Jul 27, 2022
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
15 changes: 0 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,7 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Run RuboCop
run: bundle exec rubocop

- name: Build
run: bundle exec middleman build
env:
NO_CONTRACTS: "true"

prettier:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
- run: npm install
- name: Prettier JS
run: npx prettier --check assets/javascripts
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Test
on: [pull_request]

jobs:
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1.2'
bundler-cache: true

- name: Run RuboCop
run: bundle exec rubocop

- name: Run HAML-Lint
run: bundle exec haml-lint source

prettier:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
- run: npm install
- name: Prettier JS
run: npx prettier --check assets/javascripts
78 changes: 78 additions & 0 deletions .haml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
skip_frontmatter: true

linters:
ClassesBeforeIds:
exclude:
- "source/guides/getting_started.html.haml"
- "source/layouts/_navbar.haml"
- "source/layouts/two_column_layout.haml"

HtmlAttributes:
exclude:
- "source/layouts/base.haml"

IdNames:
exclude:
- "source/guides/bundler_plugins.html.haml"
- "source/guides/bundler_workflow.html.haml"
- "source/guides/rails.html.haml"
- "source/v1.15/guides/rails.html.haml"

InlineStyles:
exclude:
- "source/contributors.html.haml"
- "source/layouts/_navbar.haml"

LineLength:
max: 849

RepeatedId:
exclude:
- "source/guides/bundler_plugins.html.haml"

RuboCop:
exclude:
- "source/contributors.html.haml"
- "source/layouts/_favicon.haml"
- "source/layouts/blog_layout.haml"

SpaceBeforeScript:
exclude:
- "source/v1.13/whats_new.html.haml"
- "source/v1.14/whats_new.html.haml"
- "source/v1.15/whats_new.html.haml"
- "source/v1.16/whats_new.html.haml"
- "source/v1.17/whats_new.html.haml"
- "source/v2.0/whats_new.html.haml"
- "source/v2.1/whats_new.html.haml"
- "source/v2.2/whats_new.html.haml"
- "source/v2.3/whats_new.html.haml"

SpaceInsideHashAttributes:
exclude:
- "source/contributors.html.haml"
- "source/layouts/_favicon.haml"
- "source/layouts/_navbar.haml"
- "source/layouts/base.haml"
- "source/partials/_commands_sidebar.haml"
- "source/partials/_guides_sidebar.haml"

TagName:
exclude:
- "source/contributors.html.haml"

UnnecessaryStringOutput:
exclude:
- "source/layouts/base.haml"
- "source/v1.13/whats_new.html.haml"
- "source/v1.14/whats_new.html.haml"
- "source/v1.15/whats_new.html.haml"
- "source/v1.16/whats_new.html.haml"
- "source/v1.17/whats_new.html.haml"
- "source/v2.0/whats_new.html.haml"
- "source/v2.1/whats_new.html.haml"
- "source/v2.2/whats_new.html.haml"
- "source/v2.3/whats_new.html.haml"

ViewLength:
max: 413
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ gem 'haml', '~> 5.2.2'
group :development do
gem 'pry'
gem 'pry-byebug'

gem "haml_lint", "~> 0.40"
gem 'rubocop'
end
8 changes: 8 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ GEM
haml (5.2.2)
temple (>= 0.8.0)
tilt
haml_lint (0.40.0)
haml (>= 4.0, < 5.3)
parallel (~> 1.10)
rainbow
rubocop (>= 0.50.0)
sysexits (~> 1.1)
hamster (3.0.0)
concurrent-ruby (~> 1.0)
hashie (3.6.0)
Expand Down Expand Up @@ -169,6 +175,7 @@ GEM
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
servolux (0.13.0)
sysexits (1.2.0)
temple (0.8.2)
thor (1.2.1)
tilt (2.0.10)
Expand All @@ -190,6 +197,7 @@ PLATFORMS
DEPENDENCIES
builder
haml (~> 5.2.2)
haml_lint (~> 0.40)
kramdown
middleman (~> 4.4)
middleman-blog
Expand Down