standard-mkv 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/test.yml +27 -0
  3. data/.gitignore +9 -0
  4. data/.standard.yml +4 -0
  5. data/CHANGELOG.md +304 -0
  6. data/Gemfile +13 -0
  7. data/Gemfile.lock +64 -0
  8. data/LICENSE.txt +25 -0
  9. data/README.md +451 -0
  10. data/Rakefile +12 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/config/base.yml +1205 -0
  14. data/config/ruby-1.8.yml +7 -0
  15. data/config/ruby-1.9.yml +7 -0
  16. data/config/ruby-2.2.yml +5 -0
  17. data/config/ruby-2.3.yml +1 -0
  18. data/config/ruby-2.4.yml +4 -0
  19. data/config/ruby-2.5.yml +7 -0
  20. data/config/ruby-2.7.yml +7 -0
  21. data/docs/RELEASE.md +42 -0
  22. data/exe/standardrb +7 -0
  23. data/lib/standard/builds_config.rb +36 -0
  24. data/lib/standard/cli.rb +17 -0
  25. data/lib/standard/cop/block_single_line_braces.rb +96 -0
  26. data/lib/standard/creates_config_store/assigns_rubocop_yaml.rb +34 -0
  27. data/lib/standard/creates_config_store/configures_ignored_paths.rb +45 -0
  28. data/lib/standard/creates_config_store/sets_target_ruby_version.rb +25 -0
  29. data/lib/standard/creates_config_store.rb +23 -0
  30. data/lib/standard/detects_fixability.rb +16 -0
  31. data/lib/standard/file_finder.rb +13 -0
  32. data/lib/standard/formatter.rb +90 -0
  33. data/lib/standard/loads_runner.rb +9 -0
  34. data/lib/standard/loads_yaml_config.rb +59 -0
  35. data/lib/standard/merges_settings.rb +68 -0
  36. data/lib/standard/parses_cli_option.rb +21 -0
  37. data/lib/standard/railtie.rb +11 -0
  38. data/lib/standard/rake.rb +26 -0
  39. data/lib/standard/rubocop/ext.rb +16 -0
  40. data/lib/standard/runners/genignore.rb +44 -0
  41. data/lib/standard/runners/help.rb +45 -0
  42. data/lib/standard/runners/rubocop.rb +19 -0
  43. data/lib/standard/runners/version.rb +9 -0
  44. data/lib/standard/version.rb +3 -0
  45. data/lib/standard.rb +13 -0
  46. data/standard.gemspec +24 -0
  47. metadata +118 -0
@@ -0,0 +1,26 @@
1
+ module Standard
2
+ module RakeSupport
3
+ # Allow command line flags set in STANDARDOPTS (like MiniTest's TESTOPTS)
4
+ def self.argvify
5
+ if ENV["STANDARDOPTS"]
6
+ ENV["STANDARDOPTS"].split(/\s+/)
7
+ else
8
+ []
9
+ end
10
+ end
11
+ end
12
+ end
13
+
14
+ desc "Lint with the Standard Ruby style guide"
15
+ task :standard do
16
+ require "standard"
17
+ exit_code = Standard::Cli.new(Standard::RakeSupport.argvify).run
18
+ fail unless exit_code == 0
19
+ end
20
+
21
+ desc "Lint and automatically fix with the Standard Ruby style guide"
22
+ task :"standard:fix" do
23
+ require "standard"
24
+ exit_code = Standard::Cli.new(Standard::RakeSupport.argvify + ["--fix"]).run
25
+ fail unless exit_code == 0
26
+ end
@@ -0,0 +1,16 @@
1
+ module RuboCop
2
+ class Cop::Lint::AssignmentInCondition
3
+ undef_method :message
4
+ def message(_)
5
+ "Wrap assignment in parentheses if intentional"
6
+ end
7
+ end
8
+
9
+ class DirectiveComment
10
+ remove_const :DIRECTIVE_COMMENT_REGEXP
11
+ DIRECTIVE_COMMENT_REGEXP = Regexp.new(
12
+ ('# (?:standard|rubocop) : ((?:disable|enable|todo))\b ' + COPS_PATTERN)
13
+ .gsub(" ", '\s*')
14
+ )
15
+ end
16
+ end
@@ -0,0 +1,44 @@
1
+ require "tempfile"
2
+ require "yaml"
3
+ require_relative "rubocop"
4
+
5
+ module Standard
6
+ module Runners
7
+ class Genignore
8
+ def call(config)
9
+ # Place to temporally store the ignored files.
10
+ temp_file = Tempfile.new("excluded.txt")
11
+ begin
12
+ # Run Rubocop to generate the files with errors into the temp file.
13
+ config.rubocop_options[:formatters] = [["json", temp_file.path]]
14
+ config.rubocop_options[:out] = temp_file.path
15
+ exit_code = Runners::Rubocop.new.call(config)
16
+
17
+ result = JSON.parse(temp_file.read)
18
+ ignore = result["files"].select { |file|
19
+ file["offenses"].size > 0
20
+ }.map { |file|
21
+ {
22
+ file["path"] => file["offenses"].map { |o| o["cop_name"] }.uniq
23
+ }
24
+ }
25
+
26
+ # Read the files with errors from the temp file.
27
+ yaml_format_errors = {"ignore" => ignore}
28
+
29
+ # Regenerate the todo file.
30
+ File.open(".standard_todo.yml", "w") do |file|
31
+ file.puts "# Auto generated files with errors to ignore."
32
+ file.puts "# Remove from this list as you refactor files."
33
+ file.write(yaml_format_errors.to_yaml)
34
+ end
35
+ exit_code
36
+ ensure
37
+ # Clean up temp file.
38
+ temp_file.close
39
+ temp_file.unlink
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,45 @@
1
+ require_relative "../file_finder"
2
+
3
+ module Standard
4
+ module Runners
5
+ class Help
6
+ def call(config)
7
+ puts <<-MESSAGE.gsub(/^ {10}/, "")
8
+ Usage: standardrb [--fix] [-vh] [--format <name>] [--] [FILE]...
9
+
10
+ Options:
11
+
12
+ --fix Automatically fix failures where possible
13
+ --no-fix Do not automatically fix failures
14
+ --format <name> Format output with any RuboCop formatter (e.g. "json")
15
+ --generate-todo Create a .standard_todo.yml that lists all the files that contain errors
16
+ -v, --version Print the version of Standard
17
+ -h, --help Print this message
18
+ FILE Files to lint [default: ./]
19
+
20
+ Standard also forwards most CLI arguments to RuboCop. To see them, run:
21
+
22
+ $ rubocop --help
23
+
24
+ While Standard only offers a few configuration options, most can be set in
25
+ a `.standard.yml` file. For full documentation, please visit:
26
+
27
+ https://github.com/testdouble/standard
28
+
29
+ Having trouble? Here's some diagnostic information:
30
+
31
+ Ruby version: #{RUBY_VERSION}
32
+ Current directory: #{Dir.pwd}
33
+ RuboCop version: #{RuboCop::Version.version}
34
+ Standard version: #{Standard::VERSION}
35
+ Standard config file: #{FileFinder.new.call(".standard.yml", Dir.pwd) || "[No file found]"}
36
+
37
+ Please report any problems (and include the above information) at the URL below:
38
+
39
+ https://github.com/testdouble/standard/issues/new
40
+
41
+ MESSAGE
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,19 @@
1
+ require "rubocop"
2
+
3
+ module Standard
4
+ module Runners
5
+ class Rubocop
6
+ def call(config)
7
+ rubocop_runner = RuboCop::CLI::Command::ExecuteRunner.new(
8
+ RuboCop::CLI::Environment.new(
9
+ config.rubocop_options,
10
+ config.rubocop_config_store,
11
+ config.paths
12
+ )
13
+ )
14
+
15
+ rubocop_runner.run
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,9 @@
1
+ module Standard
2
+ module Runners
3
+ class Version
4
+ def call(config)
5
+ puts Standard::VERSION
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module Standard
2
+ VERSION = Gem::Version.new("1.3.0")
3
+ end
data/lib/standard.rb ADDED
@@ -0,0 +1,13 @@
1
+ require "rubocop"
2
+
3
+ require "standard/rubocop/ext"
4
+
5
+ require "standard/version"
6
+ require "standard/cli"
7
+ require "standard/railtie" if defined?(Rails) && defined?(Rails::Railtie)
8
+
9
+ require "standard/formatter"
10
+ require "standard/cop/block_single_line_braces"
11
+
12
+ module Standard
13
+ end
data/standard.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "standard/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "standard-mkv"
7
+ spec.version = Standard::VERSION
8
+ spec.authors = ["Justin Searls", "Francesco Canessa - makevoid"]
9
+ spec.email = ["searls@gmail.com", "makevoid@gmail.com"]
10
+ spec.required_ruby_version = ">= 2.5.0"
11
+
12
+ spec.summary = "Ruby Style Guide, with linter & automatic code fixer - @makevoid's fork"
13
+ spec.homepage = "https://github.com/makevoid/standard"
14
+
15
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
16
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ end
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency "rubocop", "1.20.0"
23
+ spec.add_dependency "rubocop-performance", "1.11.5"
24
+ end
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: standard-mkv
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Justin Searls
8
+ - Francesco Canessa - makevoid
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2021-09-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rubocop
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '='
19
+ - !ruby/object:Gem::Version
20
+ version: 1.20.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '='
26
+ - !ruby/object:Gem::Version
27
+ version: 1.20.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: rubocop-performance
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '='
33
+ - !ruby/object:Gem::Version
34
+ version: 1.11.5
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '='
40
+ - !ruby/object:Gem::Version
41
+ version: 1.11.5
42
+ description:
43
+ email:
44
+ - searls@gmail.com
45
+ - makevoid@gmail.com
46
+ executables:
47
+ - standardrb
48
+ extensions: []
49
+ extra_rdoc_files: []
50
+ files:
51
+ - ".github/workflows/test.yml"
52
+ - ".gitignore"
53
+ - ".standard.yml"
54
+ - CHANGELOG.md
55
+ - Gemfile
56
+ - Gemfile.lock
57
+ - LICENSE.txt
58
+ - README.md
59
+ - Rakefile
60
+ - bin/console
61
+ - bin/setup
62
+ - config/base.yml
63
+ - config/ruby-1.8.yml
64
+ - config/ruby-1.9.yml
65
+ - config/ruby-2.2.yml
66
+ - config/ruby-2.3.yml
67
+ - config/ruby-2.4.yml
68
+ - config/ruby-2.5.yml
69
+ - config/ruby-2.7.yml
70
+ - docs/RELEASE.md
71
+ - exe/standardrb
72
+ - lib/standard.rb
73
+ - lib/standard/builds_config.rb
74
+ - lib/standard/cli.rb
75
+ - lib/standard/cop/block_single_line_braces.rb
76
+ - lib/standard/creates_config_store.rb
77
+ - lib/standard/creates_config_store/assigns_rubocop_yaml.rb
78
+ - lib/standard/creates_config_store/configures_ignored_paths.rb
79
+ - lib/standard/creates_config_store/sets_target_ruby_version.rb
80
+ - lib/standard/detects_fixability.rb
81
+ - lib/standard/file_finder.rb
82
+ - lib/standard/formatter.rb
83
+ - lib/standard/loads_runner.rb
84
+ - lib/standard/loads_yaml_config.rb
85
+ - lib/standard/merges_settings.rb
86
+ - lib/standard/parses_cli_option.rb
87
+ - lib/standard/railtie.rb
88
+ - lib/standard/rake.rb
89
+ - lib/standard/rubocop/ext.rb
90
+ - lib/standard/runners/genignore.rb
91
+ - lib/standard/runners/help.rb
92
+ - lib/standard/runners/rubocop.rb
93
+ - lib/standard/runners/version.rb
94
+ - lib/standard/version.rb
95
+ - standard.gemspec
96
+ homepage: https://github.com/makevoid/standard
97
+ licenses: []
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: 2.5.0
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubygems_version: 3.2.3
115
+ signing_key:
116
+ specification_version: 4
117
+ summary: Ruby Style Guide, with linter & automatic code fixer - @makevoid's fork
118
+ test_files: []