texqc 0.3.2 → 0.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0320a39681a88dd049a570f07f2f7da888a252031cbc837bbeabef8193a03914
4
- data.tar.gz: d8a66224bb2ea5f9a629affc4bb775bef198557bb062278b42941cc4a197d784
3
+ metadata.gz: e88425aca179dc71ac9e248a801d9c1b186099971c9eeaeec39758f57198c64b
4
+ data.tar.gz: 3bf5fe50c3ca447464518b63fc0c239015875f101d47eb9b921a9e75ab2bdcfb
5
5
  SHA512:
6
- metadata.gz: 346a1f0a696fab388789ecd93cb0a90e65fd89943bd8d74717019c64b368d7d51354f33665a846d1a62a16b3c85fdb08aed7f6baba0aa2694cb5a195e8cfd957
7
- data.tar.gz: 7ce08f94b5116f9ee571cae314258816aec8243f4ebe7ba8b246ad8d7dc024903aa2c8927a7f405f88c18e25d56948e70bacdaf70704076337a846e8690a8713
6
+ metadata.gz: 8368418b1b9bdbaadfaaf0f4e2fe9b0e02e6744b0ec459d5b5d43333dbcd5aaaa6dbeb270cfc84829802ef1949bea88959e016ee5d3b5736877d661ddf58dd5f
7
+ data.tar.gz: b2feafedb767d24ac19a2e506ed7c711fe5254e7694bf201806e6c91f6282eeede0d42d614471c8b15c8723f0da338fc7464ee03b9bc30d5c2022bec0b645ccc
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.2'
24
+ VERSION = '0.7.0'
25
25
 
26
26
  STDOUT.sync = true
27
27
 
@@ -45,11 +45,22 @@ end
45
45
 
46
46
  begin
47
47
  log = Loog::REGULAR
48
+ args = []
49
+ if File.exist?('.texqc')
50
+ cfg = File.new('.texqc')
51
+ body = File.read(cfg)
52
+ extra = body.split(/\s+/).map(&:strip)
53
+ args += extra
54
+ puts "Found #{body.split(/\n/).length} lines in #{File.absolute_path(cfg)}"
55
+ end
56
+ args += ARGV
57
+
48
58
  begin
49
- opts = Slop.parse(ARGV, strict: true, help: true) do |o|
50
- o.banner = "Usage (#{VERSION}): texqc [options] file
59
+ opts = Slop.parse(args, strict: true, help: true) do |o|
60
+ o.banner = "Usage (#{VERSION}): texqc [options] file...
51
61
  Options are:"
52
- o.array '--dry', 'Don\'t fail the build on errors'
62
+ o.bool '--dry', 'Don\'t fail the build on errors'
63
+ o.array '--ignore', 'Ignore given regexp'
53
64
  o.bool '--version', 'Print current version' do
54
65
  puts VERSION
55
66
  exit
@@ -65,30 +76,37 @@ Options are:"
65
76
  rescue Slop::Error => ex
66
77
  raise ex.message
67
78
  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
- [
79
+ candidates = opts.arguments
80
+ candidates += Dir['*.tex'] if candidates.empty?
81
+ candidates.each do |doc|
82
+ if doc.end_with?('.tex')
83
+ log.info("File extention removed from #{doc.inspect}")
84
+ doc = doc.gsub(/\.tex$/, '')
85
+ end
86
+ f = "#{doc}.log"
87
+ e = Errors.new
88
+ matches = [
79
89
  /^Underfull /,
80
90
  /^Overfull /,
81
91
  /^LaTeX Warning: /,
92
+ /^pdfTeX warning: /,
82
93
  /^Class [a-zA-Z0-9\*]+ Warning: /,
83
94
  /^Package [a-zA-Z0-9\*]+ Warning: /,
84
95
  /^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
96
+ ]
97
+ File.readlines(f).each_with_index do |t, i|
98
+ matches.each do |p|
99
+ next unless p.match?(t)
100
+ next if opts[:ignore].any? { |re| /.*#{re}.*/.match?(t) }
101
+ e.report(i, t)
102
+ end
103
+ end
104
+ unless e.count.zero?
105
+ log.info("#{e.count} LaTeX processing errors found in #{f.inspect}")
106
+ exit 1
107
+ end
108
+ log.info("No LaTeX processing errors found in #{f.inspect}")
90
109
  end
91
- log.info("No LaTeX processing errors found in #{f.inspect}")
92
110
  rescue StandardError => ex
93
111
  if opts[:verbose]
94
112
  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,31 @@ 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
59
+
60
+ Scenario: Bad LaTeX log output checked with LaTeX warning, but ignored with .texqc
61
+ Given I have a "article.tex" file with content:
62
+ """
63
+ \documentclass{article}
64
+ \begin{document}
65
+ test\label{xxx}test\label{xxx}
66
+ \end{document}
67
+ """
68
+ And I have a ".texqc" file with content:
69
+ """
70
+ --ignore 'may have changed' article.tex
71
+ """
72
+ When I run bash with "pdflatex article.tex"
73
+ Then I run bin/texqc
74
+ 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.2'
35
+ s.version = '0.7.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'
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.2
4
+ version: 0.7.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-09-18 00:00:00.000000000 Z
11
+ date: 2021-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace
@@ -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