linter 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ceb622ab960b3b1acc543c89e7547c308a279a26dbe4093c305184932559e801
4
- data.tar.gz: a000bbffd2abb54812bd1762bca8985121f5d0b7c9736ff07b4d7184ce58ebf3
3
+ metadata.gz: 891a38caa1685cee1fe11e2006c807c23b8e112028ad552007898138673ee683
4
+ data.tar.gz: 3d68d364d06b5d2a6bc832c5c94cfb2a84f563dafcb649d22544ec04af74abf0
5
5
  SHA512:
6
- metadata.gz: 89b07c343065872b75590dfc757718550c8114522229f9aa9ad21f3ff0d1b48a68de49f2903da78e5d6a72d832ad4af139c089e58d53719cbdbc8f9c32b68255
7
- data.tar.gz: 9db243a571e737dd07b08939360807f7172eb9e050cd2f05f196cd21961e4af7587728fde8a3917a6f2f416eaceb7334e32b427db9b5e145dbb9bec73fa2ecf7
6
+ metadata.gz: fb351872595a77331720b17af03161e5e1bc2ab4e0cb726e2d078992d8aedd588cbda4141b223a22e7d69e6c9b614cafa625029a4ee054394c4cbf7b208f30a7
7
+ data.tar.gz: 9981d44b3f7ab665a60570a1921ba1eb81f461e0475b49fca66d2f5549b1a85c2ee4f28cd20eeb61158fb6fd367e3b36613c2aacf1ec2352fdcbcbcb17d287bd
@@ -5,3 +5,14 @@ rspec:
5
5
  script:
6
6
  - bundle install
7
7
  - bundle exec rspec
8
+
9
+ rubocop:
10
+ stage: test
11
+ only:
12
+ - merge_requests
13
+ script:
14
+ - bundle install
15
+ - bundle exec rubocop
16
+
17
+ include:
18
+ template: Dependency-Scanning.gitlab-ci.yml
@@ -0,0 +1,70 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ require:
4
+ - rubocop-rspec
5
+ AllCops:
6
+ TargetRubyVersion: 2.6
7
+ # Cop names are displayed in offense messages by default. Change behavior
8
+ # by overriding DisplayCopNames, or by giving the `--no-display-cop-names`
9
+ # option.
10
+ DisplayCopNames: true
11
+ # Style guide URLs are not displayed in offense messages by default. Change
12
+ # behavior by overriding DisplayStyleGuide, or by giving the
13
+ # -S/--display-style-guide option.
14
+ DisplayStyleGuide: false
15
+ # Exclude some GitLab files
16
+ Exclude:
17
+ - '.gitlab/**/*'
18
+
19
+ Style/NumericLiteralPrefix:
20
+ Enabled: false
21
+ Metrics/BlockLength:
22
+ Enabled: false
23
+ Layout/LineLength:
24
+ Enabled: false
25
+ Style/Documentation:
26
+ Enabled: false
27
+ RSpec/FilePath:
28
+ Enabled: false
29
+ Metrics/AbcSize:
30
+ Max: 60
31
+ Metrics/MethodLength:
32
+ Max: 30
33
+ RSpec/ExampleLength:
34
+ Enabled: false
35
+ RSpec/MultipleExpectations:
36
+ Max: 2
37
+ RSpec/NestedGroups:
38
+ Max: 5
39
+ Layout/SpaceInsideHashLiteralBraces:
40
+ Enabled: false
41
+ Layout/EmptyLinesAroundAttributeAccessor:
42
+ Enabled: true
43
+ Layout/SpaceAroundMethodCallOperator:
44
+ Enabled: true
45
+ Layout/SpaceInsideBlockBraces:
46
+ Enabled: false
47
+ Style/SlicingWithRange:
48
+ Enabled: true
49
+ Style/ConditionalAssignment:
50
+ EnforcedStyle: assign_inside_condition
51
+ Lint/DeprecatedOpenSSLConstant:
52
+ Enabled: true
53
+ Lint/MixedRegexpCaptureTypes:
54
+ Enabled: true
55
+ Lint/RaiseException:
56
+ Enabled: true
57
+ Lint/StructNewOverride:
58
+ Enabled: true
59
+ Style/ExponentialNotation:
60
+ Enabled: true
61
+ Style/HashEachMethods:
62
+ Enabled: true
63
+ Style/HashTransformKeys:
64
+ Enabled: true
65
+ Style/HashTransformValues:
66
+ Enabled: true
67
+ Style/RedundantRegexpCharacterClass:
68
+ Enabled: true
69
+ Style/RedundantRegexpEscape:
70
+ Enabled: true
@@ -0,0 +1,60 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2020-06-06 22:58:53 +0200 using RuboCop version 0.85.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
12
+ Layout/ExtraSpacing:
13
+ Exclude:
14
+ - 'linter.gemspec'
15
+
16
+ # Offense count: 3
17
+ # Cop supports --auto-correct.
18
+ Layout/SpaceAfterComma:
19
+ Exclude:
20
+ - 'lib/linter/gender_association.rb'
21
+ - 'lib/linter/misused_words.rb'
22
+ - 'lib/linter/pronoun_association.rb'
23
+
24
+ # Offense count: 1
25
+ # Cop supports --auto-correct.
26
+ # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
27
+ # SupportedStylesForExponentOperator: space, no_space
28
+ Layout/SpaceAroundOperators:
29
+ Exclude:
30
+ - 'linter.gemspec'
31
+
32
+ # Offense count: 4
33
+ Lint/IneffectiveAccessModifier:
34
+ Exclude:
35
+ - 'lib/linter/gender_association.rb'
36
+ - 'lib/linter/misused_words.rb'
37
+ - 'lib/linter/pronoun_association.rb'
38
+
39
+ # Offense count: 3
40
+ # Cop supports --auto-correct.
41
+ # Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
42
+ Lint/UselessAccessModifier:
43
+ Exclude:
44
+ - 'lib/linter/gender_association.rb'
45
+ - 'lib/linter/misused_words.rb'
46
+ - 'lib/linter/pronoun_association.rb'
47
+
48
+ # Offense count: 2
49
+ # Cop supports --auto-correct.
50
+ Style/ExpandPathArguments:
51
+ Exclude:
52
+ - 'linter.gemspec'
53
+
54
+ # Offense count: 1
55
+ # Cop supports --auto-correct.
56
+ # Configuration parameters: EnforcedStyle.
57
+ # SupportedStyles: always, always_true, never
58
+ Style/FrozenStringLiteralComment:
59
+ Exclude:
60
+ - 'linter.gemspec'
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ source 'https://rubygems.org'
4
4
 
5
5
  group :development do
6
6
  gem 'pry'
@@ -1,21 +1,28 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- linter (0.1.5)
4
+ linter (0.1.6)
5
5
  colorize (~> 0.8)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
+ ast (2.4.0)
10
11
  coderay (1.1.3)
11
12
  colorize (0.8.1)
12
13
  diff-lcs (1.3)
13
14
  method_source (1.0.0)
15
+ parallel (1.19.1)
16
+ parser (2.7.1.3)
17
+ ast (~> 2.4.0)
14
18
  pry (0.13.1)
15
19
  coderay (~> 1.1)
16
20
  method_source (~> 1.0)
21
+ rainbow (3.0.0)
17
22
  rake (10.5.0)
18
23
  rb-readline (0.5.5)
24
+ regexp_parser (1.7.0)
25
+ rexml (3.2.4)
19
26
  rspec (3.9.0)
20
27
  rspec-core (~> 3.9.0)
21
28
  rspec-expectations (~> 3.9.0)
@@ -29,6 +36,21 @@ GEM
29
36
  diff-lcs (>= 1.2.0, < 2.0)
30
37
  rspec-support (~> 3.9.0)
31
38
  rspec-support (3.9.3)
39
+ rubocop (0.85.0)
40
+ parallel (~> 1.10)
41
+ parser (>= 2.7.0.1)
42
+ rainbow (>= 2.2.2, < 4.0)
43
+ regexp_parser (>= 1.7)
44
+ rexml
45
+ rubocop-ast (>= 0.0.3)
46
+ ruby-progressbar (~> 1.7)
47
+ unicode-display_width (>= 1.4.0, < 2.0)
48
+ rubocop-ast (0.0.3)
49
+ parser (>= 2.7.0.1)
50
+ rubocop-rspec (1.39.0)
51
+ rubocop (>= 0.68.1)
52
+ ruby-progressbar (1.10.1)
53
+ unicode-display_width (1.7.0)
32
54
 
33
55
  PLATFORMS
34
56
  ruby
@@ -40,6 +62,8 @@ DEPENDENCIES
40
62
  rake (~> 10.0)
41
63
  rb-readline
42
64
  rspec (~> 3.0)
65
+ rubocop (~> 0.85)
66
+ rubocop-rspec (~> 1.39)
43
67
 
44
68
  BUNDLED WITH
45
69
  1.17.2
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ task default: :spec
@@ -1,15 +1,16 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "linter"
4
+ require 'bundler/setup'
5
+ require 'linter'
5
6
  require 'pry'
6
7
 
7
8
  # You can add fixtures and/or initialization code here to make experimenting
8
9
  # with your gem easier. You can also use a different console, if you like.
9
10
 
10
11
  # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
+ # require 'pry'
12
13
  # Pry.start
13
14
 
14
- require "irb"
15
+ require 'irb'
15
16
  IRB.start(__FILE__)
data/bin/linter CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- require_relative "../lib/linter"
2
+ # frozen_string_literal: true
3
+
4
+ require_relative '../lib/linter'
3
5
 
4
6
  Linter::CLI.analyze(ARGV[0])
@@ -110,3 +110,25 @@ problematic:
110
110
  - impassioned
111
111
  - piercing
112
112
  - vehement
113
+ - word: lame
114
+ reason: |
115
+ "Lame" was originally used in reference to people with reduced mobility
116
+ due to physical disability. The word is now tossed around everywhere to
117
+ mean "uncool" and "unappealing." Disability rights activists have long
118
+ called for the word to phase out. We have a responsibility to respect that.
119
+ replace_with:
120
+ - old hat
121
+ - hackneyed
122
+ - stodgy
123
+ - jejune
124
+ - pedestrian
125
+ - humdrum
126
+ - word: retarded
127
+ reason: |
128
+ The term "mental retardation" is a stale, clinical term once used to label
129
+ what we now call intellectual disabilities. Using the term to mean "stupid"
130
+ devalues those with intellectual disabilities, which should make you
131
+ question your word choice.
132
+ replace_with:
133
+ - If you are using it as a descriptor for a person with an intellectual disability in a context where such a descriptor is necessary, you could replace it with a term that does not have the same derogatory connotation, or the name of the actual disability if relevant.
134
+ - If you are using it to insult someone (e.g. "You're such a retard") then don't.
@@ -1,13 +1,15 @@
1
- require_relative "linter/version"
2
- require_relative "linter/base_association"
3
- require_relative "linter/gender_association"
4
- require_relative "linter/pronoun_association"
5
- require_relative "linter/cli"
6
- require_relative "linter/misused_words"
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'linter/version'
4
+ require_relative 'linter/base_association'
5
+ require_relative 'linter/gender_association'
6
+ require_relative 'linter/pronoun_association'
7
+ require_relative 'linter/cli'
8
+ require_relative 'linter/misused_words'
7
9
 
8
10
  require 'yaml'
9
11
  require 'colorize'
10
- require "ostruct"
12
+ require 'ostruct'
11
13
 
12
14
  module Linter
13
15
  class Error < StandardError; end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Linter
2
4
  class BaseAssociation
3
5
  def self.analyze(text)
@@ -19,8 +21,6 @@ module Linter
19
21
  result
20
22
  end
21
23
 
22
- private
23
-
24
24
  def self.word_count(text, word)
25
25
  if self::FULL_WORD
26
26
  regex = /\b#{word}\b/i
@@ -33,9 +33,9 @@ module Linter
33
33
  # Use Enumerable#tally with Ruby 2.7
34
34
  matches
35
35
  .flatten
36
- .map { |word| word.downcase }
36
+ .map(&:downcase)
37
37
  .group_by { |v| v }
38
- .map { |k, v| [k, v.size] }
38
+ .transform_values(&:size)
39
39
  .to_h
40
40
  end
41
41
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Linter
2
4
  class CLI
3
5
  def self.analyze(file_name)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Linter
2
4
  class GenderAssociation < BaseAssociation
3
5
  FULL_WORD = false
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Linter
2
4
  class MisusedWords
3
5
  def self.analyze(text)
@@ -1,18 +1,22 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Linter
2
4
  class PronounAssociation < BaseAssociation
3
5
  FULL_WORD = true
4
6
 
5
- private
6
-
7
7
  def self.wordlists
8
8
  file_path = File.join(__dir__,'../../data/pronoun_association_wordlist.yml')
9
9
  @wordlists ||= YAML.load_file(file_path)
10
10
  end
11
11
 
12
+ private
13
+
12
14
  def self.calculate_trend(result)
13
15
  return 'masculine-coded' if result.masculine_coded_word_counts.values.sum.positive?
16
+
14
17
  return 'feminine-coded' if result.feminine_coded_word_counts.values.sum.positive?
15
- return 'neutral'
18
+
19
+ 'neutral'
16
20
  end
17
21
  end
18
22
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Linter
2
- VERSION = "0.1.5"
4
+ VERSION = '0.1.6'
3
5
  end
@@ -1,44 +1,47 @@
1
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path('../lib', __FILE__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "linter/version"
3
+ require 'linter/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "linter"
6
+ spec.name = 'linter'
7
7
  spec.version = Linter::VERSION
8
- spec.authors = ["lien van den steen"]
9
- spec.email = ["lienvandensteen@gmail.com"]
8
+ spec.authors = ['lien van den steen']
9
+ spec.email = ['lienvandensteen@gmail.com']
10
10
 
11
11
  spec.summary = 'Library to check a text for gender coded language'
12
12
  # spec.description = %q{TODO: Write a longer description or delete this line.}
13
- spec.homepage = "https://gitlab.com/lienvdsteen/linter"
14
- spec.license = "MIT"
13
+ spec.homepage = 'https://gitlab.com/lienvdsteen/linter'
14
+ spec.license = 'MIT'
15
15
 
16
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the "allowed_push_host"
17
17
  # to allow pushing to a single host or delete this section to allow pushing to any host.
18
18
  if spec.respond_to?(:metadata)
19
- # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
19
+ # spec.metadata["allowed_push_host"] = "TODO: Set to "http://mygemserver.com"
20
20
 
21
- spec.metadata["homepage_uri"] = 'https://gitlab.com/lienvdsteen/linter'
22
- spec.metadata["source_code_uri"] = "https://gitlab.com/lienvdsteen/linter"
23
- # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
21
+ spec.metadata['homepage_uri'] = 'https://gitlab.com/lienvdsteen/linter'
22
+ spec.metadata['source_code_uri'] = 'https://gitlab.com/lienvdsteen/linter'
23
+ # spec.metadata['changelog_uri'] = 'TODO: Put your gem's CHANGELOG.md URL here.'
24
24
  else
25
- raise "RubyGems 2.0 or newer is required to protect against " \
26
- "public gem pushes."
25
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
26
+ 'public gem pushes.'
27
27
  end
28
28
 
29
29
  # Specify which files should be added to the gem when it is released.
30
30
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
31
+ # Use expand_path(__dir__) instead of expand_path('..', __FILE__).
31
32
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
32
33
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
33
34
  end
34
- spec.bindir = "exe"
35
+ spec.bindir = 'exe'
35
36
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
- spec.require_paths = ["lib"]
37
+ spec.require_paths = ['lib']
37
38
 
38
- spec.add_development_dependency "bundler", "~> 1.17"
39
- spec.add_development_dependency "rake", "~> 10.0"
40
- spec.add_development_dependency "rspec", "~> 3.0"
39
+ spec.add_development_dependency 'bundler', '~> 1.17'
41
40
  spec.add_development_dependency 'pry', '~> 0.13'
41
+ spec.add_development_dependency 'rake', '~> 10.0'
42
+ spec.add_development_dependency 'rspec', '~> 3.0'
43
+ spec.add_development_dependency 'rubocop', '~> 0.85'
44
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.39'
42
45
 
43
46
  spec.add_dependency('colorize', '~> 0.8')
44
47
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - lien van den steen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-06 00:00:00.000000000 Z
11
+ date: 2020-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.17'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.13'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.13'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,19 +67,33 @@ dependencies:
53
67
  - !ruby/object:Gem::Version
54
68
  version: '3.0'
55
69
  - !ruby/object:Gem::Dependency
56
- name: pry
70
+ name: rubocop
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '0.13'
75
+ version: '0.85'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '0.13'
82
+ version: '0.85'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.39'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.39'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: colorize
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -90,6 +118,8 @@ files:
90
118
  - ".gitignore"
91
119
  - ".gitlab-ci.yml"
92
120
  - ".rspec"
121
+ - ".rubocop.yml"
122
+ - ".rubocop_todo.yml"
93
123
  - ".ruby-version"
94
124
  - ".travis.yml"
95
125
  - CODE_OF_CONDUCT.md