texqc 0.3.1 → 0.6.0

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: 11c959ccc1a42d66bc7d3d3daa09ca54a8ebdf98facb6354d57238398238d63a
4
- data.tar.gz: b1fa00eb6c705501b0f9b5cd3663c91f8b52b1c5393c87076f715777808fd498
3
+ metadata.gz: c6417dba6502ed4e98ee381614ada43663890850be482dc3e7f4dc30b72b8d25
4
+ data.tar.gz: 36a4e4704d3f35c92a7ab5ae66ced90d33f83cf96bea35c2138aaf526ea70095
5
5
  SHA512:
6
- metadata.gz: d92293bb5536644213817b1d003feb3d13de5a2eb784a17dfde450cb3940cbf0d81683344c99767ae012b3dbd909dc0397cf9ef00c822b442d149e066118f790
7
- data.tar.gz: 6e6492a16bc3c31293a64e830d8ad8f637378c192b2ccd76971f3fff60dc32cf65883cd42c8e046105db5b74287710947616cb20f3736e3425d12e80aeaf413c
6
+ metadata.gz: b61800ce2230eb64d841be40bc6dcabc6eeb4359878c7225b16be4cb1539c5812f90493e190ca02b2b20838a3d15ad8289ec30198b7ae1483824cfa4601b6244
7
+ data.tar.gz: 6b2481529eb732483a68acf882a8311c15088658d6e5b04bed6a766e4a89f8f33b20fda47f08852baaa1e84fd3b9f9696b9d5d54a3d35fa0208f65d10f78a67b
data/.rultor.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  assets:
2
2
  rubygems.yml: yegor256/home#assets/rubygems.yml
3
3
  install: |
4
+ export PATH=$PATH:/usr/local/texlive/2021/bin/x86_64-linux/
4
5
  sudo apt install -y aspell
5
6
  pdd -f /dev/null
6
7
  sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
data/.simplecov CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020 Yegor Bugayenko
1
+ # Copyright (c) 2020-2021 Yegor Bugayenko
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  # of this software and associated documentation files (the 'Software'), to deal
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2020 Yegor Bugayenko
3
+ # Copyright (c) 2020-2021 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2020 Yegor Bugayenko
3
+ # Copyright (c) 2020-2021 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/bin/texqc CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- # Copyright (c) 2020 Yegor Bugayenko
4
+ # Copyright (c) 2020-2021 Yegor Bugayenko
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  # of this software and associated documentation files (the 'Software'), to deal
@@ -21,7 +21,7 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  # SOFTWARE.
23
23
 
24
- VERSION = '0.3.1'
24
+ VERSION = '0.6.0'
25
25
 
26
26
  STDOUT.sync = true
27
27
 
@@ -47,9 +47,10 @@ begin
47
47
  log = Loog::REGULAR
48
48
  begin
49
49
  opts = Slop.parse(ARGV, strict: true, help: true) do |o|
50
- o.banner = "Usage (#{VERSION}): texqc [options] file
50
+ o.banner = "Usage (#{VERSION}): texqc [options] file...
51
51
  Options are:"
52
- o.array '--dry', 'Don\'t fail the build on errors'
52
+ o.bool '--dry', 'Don\'t fail the build on errors'
53
+ o.array '--ignore', 'Ignore given regexp'
53
54
  o.bool '--version', 'Print current version' do
54
55
  puts VERSION
55
56
  exit
@@ -65,30 +66,37 @@ Options are:"
65
66
  rescue Slop::Error => ex
66
67
  raise ex.message
67
68
  end
68
- raise 'Try --help' if opts.arguments.empty?
69
- raise 'Too many arguments' unless opts.arguments.length == 1
70
- doc = opts.arguments[0]
71
- if doc.end_with?('.tex')
72
- log.info("File extention removed from #{doc.inspect}")
73
- doc = doc.gsub(/\.tex$/, '')
74
- end
75
- f = "#{doc}.log"
76
- e = Errors.new
77
- File.readlines(f).each_with_index do |t, i|
78
- [
69
+ candidates = opts.arguments
70
+ candidates += Dir['*.tex'] if candidates.empty?
71
+ candidates.each do |doc|
72
+ if doc.end_with?('.tex')
73
+ log.info("File extention removed from #{doc.inspect}")
74
+ doc = doc.gsub(/\.tex$/, '')
75
+ end
76
+ f = "#{doc}.log"
77
+ e = Errors.new
78
+ matches = [
79
79
  /^Underfull /,
80
80
  /^Overfull /,
81
81
  /^LaTeX Warning: /,
82
+ /^pdfTeX warning: /,
82
83
  /^Class [a-zA-Z0-9\*]+ Warning: /,
83
84
  /^Package [a-zA-Z0-9\*]+ Warning: /,
84
85
  /^LaTeX Font Warning: /
85
- ].each { |p| e.report(i, t) if p.match?(t) }
86
- end
87
- unless e.count.zero?
88
- log.info("#{e.count} LaTeX processing errors found in #{f.inspect}")
89
- exit 1
86
+ ]
87
+ File.readlines(f).each_with_index do |t, i|
88
+ matches.each do |p|
89
+ next unless p.match?(t)
90
+ next if opts[:ignore].any? { |re| /.*#{re}.*/.match?(t) }
91
+ e.report(i, t)
92
+ end
93
+ end
94
+ unless e.count.zero?
95
+ log.info("#{e.count} LaTeX processing errors found in #{f.inspect}")
96
+ exit 1
97
+ end
98
+ log.info("No LaTeX processing errors found in #{f.inspect}")
90
99
  end
91
- log.info("No LaTeX processing errors found in #{f.inspect}")
92
100
  rescue StandardError => ex
93
101
  if opts[:verbose]
94
102
  puts Backtrace.new(ex).to_s
data/features/cli.feature CHANGED
@@ -15,7 +15,7 @@ Feature: Command Line Processing
15
15
  \end{document}
16
16
  """
17
17
  When I run bash with "pdflatex article.tex"
18
- Then I run bin/texqc with "article"
18
+ Then I run bin/texqc with ""
19
19
  Then Exit code is zero
20
20
  And Stdout contains "No LaTeX processing errors found"
21
21
 
@@ -44,3 +44,15 @@ Feature: Command Line Processing
44
44
  Then I run bin/texqc with "article.tex"
45
45
  Then Exit code is not zero
46
46
  And Stdout contains "1 LaTeX processing errors"
47
+
48
+ Scenario: Bad LaTeX log output checked with LaTeX warning, but ignored
49
+ Given I have a "article.tex" file with content:
50
+ """
51
+ \documentclass{article}
52
+ \begin{document}
53
+ test\label{xxx}test\label{xxx}
54
+ \end{document}
55
+ """
56
+ When I run bash with "pdflatex article.tex"
57
+ Then I run bin/texqc with "--ignore 'may have changed' article.tex"
58
+ Then Exit code is zero
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2020 Yegor Bugayenko
3
+ # Copyright (c) 2020-2021 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2020 Yegor Bugayenko
3
+ # Copyright (c) 2020-2021 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/texqc.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2020 Yegor Bugayenko
3
+ # Copyright (c) 2020-2021 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.rubygems_version = '2.2'
33
33
  s.required_ruby_version = '>= 2.3'
34
34
  s.name = 'texqc'
35
- s.version = '0.3.1'
35
+ s.version = '0.6.0'
36
36
  s.license = 'MIT'
37
37
  s.summary = 'Quality Control of Your LaTeX Build'
38
38
  s.description = 'Run it after you compile your LaTeX document'
@@ -46,7 +46,7 @@ Gem::Specification.new do |s|
46
46
  s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
47
47
  s.add_runtime_dependency 'backtrace', '~> 0.3'
48
48
  s.add_runtime_dependency 'loog', '~> 0.2'
49
- s.add_runtime_dependency 'slop', '~> 4.6'
49
+ s.add_runtime_dependency 'slop', '~> 4.8.2'
50
50
  s.add_development_dependency 'codecov', '0.2.6'
51
51
  s.add_development_dependency 'cucumber', '~> 1.3.17'
52
52
  s.add_development_dependency 'rake', '12.3.3'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: texqc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-19 00:00:00.000000000 Z
11
+ date: 2021-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '4.6'
47
+ version: 4.8.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '4.6'
54
+ version: 4.8.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: codecov
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -171,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
171
  - !ruby/object:Gem::Version
172
172
  version: '0'
173
173
  requirements: []
174
- rubygems_version: 3.0.1
174
+ rubygems_version: 3.1.2
175
175
  signing_key:
176
176
  specification_version: 2
177
177
  summary: Quality Control of Your LaTeX Build