From 0ab4d181c9d2e1ad9e3d4028223f947599781351 Mon Sep 17 00:00:00 2001 From: Markus Doits Date: Fri, 30 Mar 2018 19:20:57 +0200 Subject: update locally used ruby versiob, lint everything --- .rubocop.yml | 48 +++++++++++++++++++++++++++++++++++----- .ruby-version | 2 +- Gemfile | 2 ++ Rakefile | 2 ++ lib/pronto/eslint_npm.rb | 8 ++++--- lib/pronto/eslint_npm/version.rb | 2 ++ pronto-eslint_npm.gemspec | 22 +++++++++--------- spec/pronto/eslint_spec.rb | 2 ++ spec/spec_helper.rb | 4 +++- 9 files changed, 71 insertions(+), 21 deletions(-) mode change 100644 => 100755 Rakefile diff --git a/.rubocop.yml b/.rubocop.yml index 33ec248..393726b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,18 +1,56 @@ +--- AllCops: DisplayCopNames: true DisplayStyleGuide: true + TargetRubyVersion: 2.1.0 Documentation: Enabled: false -Metrics/MethodLength: - Max: 20 +Layout/ExtraSpacing: + ForceEqualSignAlignment: true -Metrics/LineLength: - Max: 100 +Layout/MultilineMethodCallIndentation: + Enabled: false + +Lint/AmbiguousBlockAssociation: + Enabled: false Metrics/AbcSize: - Max: 20 + Max: 40 + +Metrics/BlockLength: + Enabled: false + +Metrics/ClassLength: + Max: 200 + +Metrics/CyclomaticComplexity: + Max: 15 + +Metrics/LineLength: + Max: 120 + +Metrics/MethodLength: + Max: 30 Metrics/ParameterLists: Max: 10 + +Rails: + Enabled: true + +Rails/InverseOf: + Enabled: false + +Rails/LexicallyScopedActionFilter: + Enabled: false + +Rails/SkipsModelValidations: + Enabled: false + +Rails/UnknownEnv: + Enabled: false + +Style/FormatStringToken: + Enabled: false diff --git a/.ruby-version b/.ruby-version index 0bee604..73462a5 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.3 +2.5.1 diff --git a/Gemfile b/Gemfile index fa75df1..7f4f5e9 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source 'https://rubygems.org' gemspec diff --git a/Rakefile b/Rakefile old mode 100644 new mode 100755 index dfa86a6..fcf8b82 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,6 @@ #!/usr/bin/env rake +# frozen_string_literal: true + require 'bundler' require 'rspec/core/rake_task' diff --git a/lib/pronto/eslint_npm.rb b/lib/pronto/eslint_npm.rb index bb79091..e861ffe 100644 --- a/lib/pronto/eslint_npm.rb +++ b/lib/pronto/eslint_npm.rb @@ -1,15 +1,17 @@ +# frozen_string_literal: true + require 'pronto' require 'shellwords' module Pronto class ESLintNpm < Runner CONFIG_FILE = '.pronto_eslint_npm.yml'.freeze - CONFIG_KEYS = %w(eslint_executable files_to_lint).freeze + CONFIG_KEYS = %w[eslint_executable files_to_lint].freeze attr_writer :eslint_executable def eslint_executable - @eslint_executable || 'eslint'.freeze + @eslint_executable || 'eslint' end def files_to_lint @@ -61,7 +63,7 @@ module Pronto end def new_message(offence, line) - path = line.patch.delta.new_file[:path] + path = line.patch.delta.new_file[:path] level = :warning Message.new(path, line, level, offence['message'], nil, self.class) diff --git a/lib/pronto/eslint_npm/version.rb b/lib/pronto/eslint_npm/version.rb index c22ce28..2d3f9d8 100644 --- a/lib/pronto/eslint_npm/version.rb +++ b/lib/pronto/eslint_npm/version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Pronto module ESLintNpmVersion VERSION = '0.9.0'.freeze diff --git a/pronto-eslint_npm.gemspec b/pronto-eslint_npm.gemspec index d3e3b65..2304678 100644 --- a/pronto-eslint_npm.gemspec +++ b/pronto-eslint_npm.gemspec @@ -1,29 +1,29 @@ -# -*- encoding: utf-8 -*- +# frozen_string_literal: true -$LOAD_PATH.push File.expand_path('../lib', __FILE__) +$LOAD_PATH.push File.expand_path('lib', __dir__) require 'pronto/eslint_npm/version' Gem::Specification.new do |s| - s.name = 'pronto-eslint_npm' - s.version = Pronto::ESLintNpmVersion::VERSION + s.name = 'pronto-eslint_npm' + s.version = Pronto::ESLintNpmVersion::VERSION s.platform = Gem::Platform::RUBY - s.authors = ['Markus Doits', 'Mindaugas Mozūras'] - s.email = 'markus.doits@gmail.com' + s.authors = ['Markus Doits', 'Mindaugas Mozūras'] + s.email = 'markus.doits@gmail.com' s.homepage = 'https://github.com/doits/pronto-eslint_npm' - s.summary = <<-EOF + s.summary = <<-EOF Pronto runner for ESLint, pluggable linting utility for JavaScript and JSX EOF - s.licenses = ['MIT'] + s.licenses = ['MIT'] s.required_ruby_version = '>= 2.0.0' - s.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r{^(lib/|(LICENSE|README.md)$)}) } + s.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r{^(lib/|(LICENSE|README.md)$)}) } s.extra_rdoc_files = ['LICENSE', 'README.md'] - s.require_paths = ['lib'] + s.require_paths = ['lib'] s.requirements << 'eslint (in PATH)' s.add_dependency('pronto', '~> 0.9.1') + s.add_development_dependency('byebug', '>= 9') s.add_development_dependency('rake', '>= 11.0', '< 13') s.add_development_dependency('rspec', '~> 3.4') - s.add_development_dependency('byebug', '>= 9') end diff --git a/spec/pronto/eslint_spec.rb b/spec/pronto/eslint_spec.rb index b0b9c22..52e52f2 100644 --- a/spec/pronto/eslint_spec.rb +++ b/spec/pronto/eslint_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' module Pronto diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c13fe98..b3d8596 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,9 +1,11 @@ +# frozen_string_literal: true + require 'fileutils' require 'byebug' require 'rspec' require 'pronto/eslint_npm' -%w(test eslintignore).each do |repo_name| +%w[test eslintignore].each do |repo_name| RSpec.shared_context "#{repo_name} repo" do let(:git) { "spec/fixtures/#{repo_name}.git/git" } let(:dot_git) { "spec/fixtures/#{repo_name}.git/.git" } -- cgit v1.2.3