Skip to content

Commit

Permalink
Merge pull request #36 from soundasleep/scrivo/add-rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
mscrivo authored Jun 7, 2024
2 parents 4b91b5c + e9377b2 commit b218ec5
Show file tree
Hide file tree
Showing 11 changed files with 265 additions and 167 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ permissions:

jobs:
test:

runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -33,3 +32,19 @@ jobs:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
run: bundle exec rake

lint:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['3.0', '3.1', '3.2', '3.3']

steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run Rubocop
run: bundle exec rubocop
35 changes: 35 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
require:
- rubocop-performance
- rubocop-rake

AllCops:
NewCops: enable
TargetRubyVersion: 3.0

Metrics/MethodLength:
Max: 30

Metrics/ClassLength:
Max: 200

Metrics/ModuleLength:
Max: 200

Metrics/BlockLength:
Max: 50

Gemspec/DevelopmentDependencies:
EnforcedStyle: gemspec

# TODO: Enable these cops after fixing the issues
Metrics/CyclomaticComplexity:
Enabled: false

Metrics/PerceivedComplexity:
Enabled: false

Metrics/AbcSize:
Enabled: false

Style/Documentation:
Enabled: false
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

# Declare your gem's dependencies in whatever.gemspec.
Expand Down
37 changes: 36 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,28 @@ PATH
GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
bundler-audit (0.6.1)
bundler (>= 1.2.0, < 3)
thor (~> 0.18)
colorize (0.7.7)
diff-lcs (1.3)
json (2.7.2)
language_server-protocol (3.17.0.3)
mini_portile2 (2.8.7)
nokogiri (1.16.5)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
parallel (1.24.0)
parser (3.3.2.0)
ast (~> 2.4.1)
racc
racc (1.8.0)
rainbow (3.1.1)
rake (12.3.3)
regexp_parser (2.9.2)
rexml (3.2.8)
strscan (>= 3.0.9)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
Expand All @@ -33,7 +44,28 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
rubocop (1.64.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
parser (>= 3.3.1.0)
rubocop-performance (1.21.0)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
ruby-progressbar (1.13.0)
strscan (3.1.0)
thor (0.20.3)
unicode-display_width (2.5.0)

PLATFORMS
ruby
Expand All @@ -45,6 +77,9 @@ DEPENDENCIES
rake
rspec
rspec-collection_matchers
rubocop
rubocop-performance
rubocop-rake

BUNDLED WITH
2.1.4
2.5.11
4 changes: 3 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
task default: :spec
41 changes: 24 additions & 17 deletions html2text.gemspec
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
$:.push File.expand_path("../lib", __FILE__)
# frozen_string_literal: true

$LOAD_PATH.push File.expand_path('lib', __dir__)

# Maintain your gem's version:
require "html2text/version"
require 'html2text/version'

# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "html2text"
s.name = 'html2text'
s.version = Html2Text::VERSION
s.authors = ["Jevon Wright"]
s.email = ["[email protected]"]
s.homepage = "https://github.com/soundasleep/html2text_ruby"
s.summary = "Convert HTML into plain text."
s.description = "A Ruby component to convert HTML into a plain text format."
s.license = "MIT"
s.authors = ['Jevon Wright']
s.email = ['[email protected]']
s.homepage = 'https://github.com/soundasleep/html2text_ruby'
s.summary = 'Convert HTML into plain text.'
s.description = 'A Ruby component to convert HTML into a plain text format.'
s.license = 'MIT'
s.required_ruby_version = '>= 3.0'

s.files = Dir['lib/**/*', 'LICENSE.md', 'README.md', 'CHANGELOG.md']

s.files = Dir["lib/**/*", "LICENSE.md", "README.md", "CHANGELOG.md"]
s.test_files = Dir["spec/**/*"]
s.add_dependency 'nokogiri', ['>= 1.0', '< 2.0']

s.add_dependency "nokogiri", ['>= 1.0', '< 2.0']
s.add_development_dependency 'bundler-audit'
s.add_development_dependency 'colorize'
s.add_development_dependency 'rake'
s.add_development_dependency 'rspec'
s.add_development_dependency 'rspec-collection_matchers'
s.add_development_dependency 'rubocop'
s.add_development_dependency 'rubocop-performance'
s.add_development_dependency 'rubocop-rake'

s.add_development_dependency "rspec"
s.add_development_dependency "rspec-collection_matchers"
s.add_development_dependency "colorize"
s.add_development_dependency "rake"
s.add_development_dependency "bundler-audit"
s.metadata['rubygems_mfa_required'] = 'true'
end
Loading

0 comments on commit b218ec5

Please sign in to comment.