texqc 0.4.0 → 0.7.1

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: 405302fd1be88ad8610cfeee7da0f9d8831fb4d9a71999de305f8b8d6e97bdb6
4
- data.tar.gz: be31a5c158ea12d077250acc711ade0f0db1e869f28be98f1629589f994d9da4
3
+ metadata.gz: bb557b3617da39110e1391bf047c8ed3c2e81a5d21b3fa3ca9fe7ca34394d307
4
+ data.tar.gz: '08658a600f3a5613a43bc6015a687769e3ac1365871b60e13767c30b90539f82'
5
5
  SHA512:
6
- metadata.gz: 6ff868d523e54df9b0acbe75b00ccb529e874a8f6ca08084b65aa92c8b82d43170f0983bb2ec84dabf77c1e5724e78edc8fdfd0a0c4cef2f6e768a4204189988
7
- data.tar.gz: f1dbc5fad72d0674486a6a244adac0c99b20ee35280544060dd1b3aa59bfc354565cfec31b54fe874c4c07a0ca30404829513983e8df229153618bd6aa1f7ab8
6
+ metadata.gz: d8368d87efc035f30f2bec54e1b376bc8ee4abe1caf9777a18cc3d584cd906adb3d5137008ddec7d1a55e5aaa4860782f5d99b5b1fe8dd149cce8e6fae2ae1dd
7
+ data.tar.gz: 45b15f158f5ed38af5978d081a3d58f6024234f2cff6970373f89832fc42b99094fc5e79b1a9011eecd62a199e0a7f9ad720ddae78a9be091f73d110d1f27242
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/bin/texqc CHANGED
@@ -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.4.0'
24
+ VERSION = '0.7.1'
25
25
 
26
26
  STDOUT.sync = true
27
27
 
@@ -45,11 +45,20 @@ end
45
45
 
46
46
  begin
47
47
  log = Loog::REGULAR
48
+ args = []
49
+ if File.exist?('.texqc')
50
+ cfg = File.new('.texqc')
51
+ args += File.readlines(cfg)
52
+ puts "Found #{args.length} lines in #{File.absolute_path(cfg)}"
53
+ end
54
+ args += ARGV
55
+
48
56
  begin
49
- opts = Slop.parse(ARGV, strict: true, help: true) do |o|
50
- o.banner = "Usage (#{VERSION}): texqc [options] file
57
+ opts = Slop.parse(args, strict: true, help: true) do |o|
58
+ o.banner = "Usage (#{VERSION}): texqc [options] file...
51
59
  Options are:"
52
- o.array '--dry', 'Don\'t fail the build on errors'
60
+ o.bool '--dry', 'Don\'t fail the build on errors'
61
+ o.array '--ignore', 'Ignore given regexp'
53
62
  o.bool '--version', 'Print current version' do
54
63
  puts VERSION
55
64
  exit
@@ -65,17 +74,17 @@ Options are:"
65
74
  rescue Slop::Error => ex
66
75
  raise ex.message
67
76
  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
- [
77
+ candidates = opts.arguments
78
+ candidates += Dir['*.tex'] if candidates.empty?
79
+ puts "Candidates: #{candidates}" if opts[:verbose]
80
+ candidates.each do |doc|
81
+ if doc.end_with?('.tex')
82
+ log.info("File extention removed from #{doc.inspect}")
83
+ doc = doc.gsub(/\.tex$/, '')
84
+ end
85
+ f = "#{doc}.log"
86
+ e = Errors.new
87
+ matches = [
79
88
  /^Underfull /,
80
89
  /^Overfull /,
81
90
  /^LaTeX Warning: /,
@@ -83,13 +92,20 @@ Options are:"
83
92
  /^Class [a-zA-Z0-9\*]+ Warning: /,
84
93
  /^Package [a-zA-Z0-9\*]+ Warning: /,
85
94
  /^LaTeX Font Warning: /
86
- ].each { |p| e.report(i, t) if p.match?(t) }
87
- end
88
- unless e.count.zero?
89
- log.info("#{e.count} LaTeX processing errors found in #{f.inspect}")
90
- exit 1
95
+ ]
96
+ File.readlines(f).each_with_index do |t, i|
97
+ matches.each do |p|
98
+ next unless p.match?(t)
99
+ next if opts[:ignore].any? { |re| /.*#{re}.*/.match?(t) }
100
+ e.report(i, t)
101
+ end
102
+ end
103
+ unless e.count.zero?
104
+ log.info("#{e.count} LaTeX processing errors found in #{f.inspect}")
105
+ exit 1
106
+ end
107
+ log.info("No LaTeX processing errors found in #{f.inspect}")
91
108
  end
92
- log.info("No LaTeX processing errors found in #{f.inspect}")
93
109
  rescue StandardError => ex
94
110
  if opts[:verbose]
95
111
  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
data/texqc.gemspec CHANGED
@@ -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.4.0'
35
+ s.version = '0.7.1'
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.4.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-09 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