texqc 0.5.0 → 0.7.2
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 +4 -4
- data/.rultor.yml +1 -0
- data/bin/texqc +43 -31
- data/features/cli.feature +19 -1
- data/texqc.gemspec +1 -1
- 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: 5a45c96dead075d82d5c86397f0597369942d19c3e65bf533088fde4c5626d8f
|
4
|
+
data.tar.gz: d7a0cf0d6ce2fad0171e714d393369c7bf92cfb2cc6e22eaf084cc417429bf2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6dd41d12942e6333f314da22372b9d2c1551d3fdf3a18c914c0a3306add080afcfce724720aba3b587691ef5534f3f86e3987516e61fe8b3eafd8b4d3bfe549
|
7
|
+
data.tar.gz: '08785e406ce6c27301acfa29bf52dc27ed9e29b6ca3b42ca54397233283cde5d480d70a449a4b47ba6ad14e4670404e1b2eb851011111c5526fd6631e260afd9'
|
data/.rultor.yml
CHANGED
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.
|
24
|
+
VERSION = '0.7.2'
|
25
25
|
|
26
26
|
STDOUT.sync = true
|
27
27
|
|
@@ -45,9 +45,17 @@ 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).map(&:strip)
|
52
|
+
puts "Found #{args.length} lines in #{File.absolute_path(cfg)}"
|
53
|
+
end
|
54
|
+
args += ARGV
|
55
|
+
|
48
56
|
begin
|
49
|
-
opts = Slop.parse(
|
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
60
|
o.bool '--dry', 'Don\'t fail the build on errors'
|
53
61
|
o.array '--ignore', 'Ignore given regexp'
|
@@ -66,36 +74,40 @@ Options are:"
|
|
66
74
|
rescue Slop::Error => ex
|
67
75
|
raise ex.message
|
68
76
|
end
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
if
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
matches = [
|
79
|
-
/^Underfull /,
|
80
|
-
/^Overfull /,
|
81
|
-
/^LaTeX Warning: /,
|
82
|
-
/^pdfTeX warning: /,
|
83
|
-
/^Class [a-zA-Z0-9\*]+ Warning: /,
|
84
|
-
/^Package [a-zA-Z0-9\*]+ Warning: /,
|
85
|
-
/^LaTeX Font Warning: /
|
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)
|
77
|
+
candidates = opts.arguments
|
78
|
+
candidates += Dir['*.tex'] if candidates.empty?
|
79
|
+
puts "Args: #{args}" if opts[:verbose]
|
80
|
+
puts "Ignore: #{opts[:ignore]}" if opts[:verbose]
|
81
|
+
puts "Candidates: #{candidates}" if opts[:verbose]
|
82
|
+
candidates.each do |doc|
|
83
|
+
if doc.end_with?('.tex')
|
84
|
+
log.info("File extention removed from #{doc.inspect}")
|
85
|
+
doc = doc.gsub(/\.tex$/, '')
|
92
86
|
end
|
87
|
+
f = "#{doc}.log"
|
88
|
+
e = Errors.new
|
89
|
+
matches = [
|
90
|
+
/^Underfull /,
|
91
|
+
/^Overfull /,
|
92
|
+
/^LaTeX Warning: /,
|
93
|
+
/^pdfTeX warning: /,
|
94
|
+
/^Class [a-zA-Z0-9\*]+ Warning: /,
|
95
|
+
/^Package [a-zA-Z0-9\*]+ Warning: /,
|
96
|
+
/^LaTeX Font Warning: /
|
97
|
+
]
|
98
|
+
File.readlines(f).each_with_index do |t, i|
|
99
|
+
matches.each do |p|
|
100
|
+
next unless p.match?(t)
|
101
|
+
next if opts[:ignore].any? { |re| /.*#{re}.*/.match?(t) }
|
102
|
+
e.report(i, t)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
unless e.count.zero?
|
106
|
+
log.info("#{e.count} LaTeX processing errors found in #{f.inspect}")
|
107
|
+
exit 1
|
108
|
+
end
|
109
|
+
log.info("No LaTeX processing errors found in #{f.inspect}")
|
93
110
|
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}")
|
99
111
|
rescue StandardError => ex
|
100
112
|
if opts[:verbose]
|
101
113
|
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
|
|
@@ -56,3 +56,21 @@ Feature: Command Line Processing
|
|
56
56
|
When I run bash with "pdflatex article.tex"
|
57
57
|
Then I run bin/texqc with "--ignore 'may have changed' article.tex"
|
58
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
|
+
--verbose
|
71
|
+
|
72
|
+
--ignore='may have changed'
|
73
|
+
"""
|
74
|
+
When I run bash with "pdflatex article.tex"
|
75
|
+
Then I run bin/texqc
|
76
|
+
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.
|
35
|
+
s.version = '0.7.2'
|
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.2
|
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-
|
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
|