texqc 0.3.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rultor.yml +1 -0
- data/.simplecov +1 -1
- data/Gemfile +1 -1
- data/Rakefile +1 -1
- data/bin/texqc +40 -22
- data/features/cli.feature +29 -1
- data/features/step_definitions/steps.rb +1 -1
- data/features/support/env.rb +1 -1
- data/texqc.gemspec +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e88425aca179dc71ac9e248a801d9c1b186099971c9eeaeec39758f57198c64b
|
4
|
+
data.tar.gz: 3bf5fe50c3ca447464518b63fc0c239015875f101d47eb9b921a9e75ab2bdcfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8368418b1b9bdbaadfaaf0f4e2fe9b0e02e6744b0ec459d5b5d43333dbcd5aaaa6dbeb270cfc84829802ef1949bea88959e016ee5d3b5736877d661ddf58dd5f
|
7
|
+
data.tar.gz: b2feafedb767d24ac19a2e506ed7c711fe5254e7694bf201806e6c91f6282eeede0d42d614471c8b15c8723f0da338fc7464ee03b9bc30d5c2022bec0b645ccc
|
data/.rultor.yml
CHANGED
data/.simplecov
CHANGED
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.
|
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(
|
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.
|
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
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
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
|
-
]
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
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 "
|
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
|
data/features/support/env.rb
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/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.
|
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.
|
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:
|
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.
|
174
|
+
rubygems_version: 3.1.2
|
175
175
|
signing_key:
|
176
176
|
specification_version: 2
|
177
177
|
summary: Quality Control of Your LaTeX Build
|