texqc 0.2.0 → 0.5.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 +4 -4
- data/.simplecov +1 -1
- data/.travis.yml +1 -0
- data/Gemfile +1 -1
- data/README.md +3 -0
- data/Rakefile +1 -1
- data/bin/texqc +40 -11
- data/features/cli.feature +13 -1
- data/features/step_definitions/steps.rb +1 -1
- data/features/support/env.rb +1 -1
- data/texqc.gemspec +5 -5
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19e114b82eed83d7dc3e0b0320418c89dbc0fbaf557b9886867837264c49939e
|
4
|
+
data.tar.gz: d815e0852ed6fdf217935cdc8a3340bffec993430b51064b5af1f0ef6f56080c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb0a5f84ecdc58c058ce1ba513cea2e30a9b3deadf42a342b254002f2ea911174f2b853ff05fa0a7ccfeb7ba9a62b193fbe79d51f7763311d378c273d211a914
|
7
|
+
data.tar.gz: 33e1ffc295e36868d42a345ac1522ffd5aa7fb5ea45caad133afb189fb0627bc4a222dabaadeb0376348df9c8ffa507b1cc15086de9bc53ace22e36bb2631eb6
|
data/.simplecov
CHANGED
data/.travis.yml
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/README.md
CHANGED
@@ -29,6 +29,9 @@ $ latexmk -pdf article
|
|
29
29
|
$ texqc article
|
30
30
|
```
|
31
31
|
|
32
|
+
If any warnings were reported by LaTeX, you will get a short list of them
|
33
|
+
and the exit code will be non-zero (very convenient for your CI/CD scripts).
|
34
|
+
|
32
35
|
## How to contribute
|
33
36
|
|
34
37
|
Read [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
|
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.5.0'
|
25
25
|
|
26
26
|
STDOUT.sync = true
|
27
27
|
|
@@ -30,13 +30,27 @@ require 'loog'
|
|
30
30
|
require 'open3'
|
31
31
|
require 'slop'
|
32
32
|
|
33
|
+
# Errors counter.
|
34
|
+
class Errors
|
35
|
+
attr_reader :count
|
36
|
+
def initialize
|
37
|
+
@count = 0
|
38
|
+
end
|
39
|
+
|
40
|
+
def report(pos, txt)
|
41
|
+
puts "[#{pos}] #{txt}"
|
42
|
+
@count += 1
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
33
46
|
begin
|
34
47
|
log = Loog::REGULAR
|
35
48
|
begin
|
36
49
|
opts = Slop.parse(ARGV, strict: true, help: true) do |o|
|
37
50
|
o.banner = "Usage (#{VERSION}): texqc [options] file
|
38
51
|
Options are:"
|
39
|
-
o.
|
52
|
+
o.bool '--dry', 'Don\'t fail the build on errors'
|
53
|
+
o.array '--ignore', 'Ignore given regexp'
|
40
54
|
o.bool '--version', 'Print current version' do
|
41
55
|
puts VERSION
|
42
56
|
exit
|
@@ -54,16 +68,31 @@ Options are:"
|
|
54
68
|
end
|
55
69
|
raise 'Try --help' if opts.arguments.empty?
|
56
70
|
raise 'Too many arguments' unless opts.arguments.length == 1
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
71
|
+
doc = opts.arguments[0]
|
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
|
+
/^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)
|
63
92
|
end
|
64
93
|
end
|
65
|
-
unless
|
66
|
-
log.info("#{
|
94
|
+
unless e.count.zero?
|
95
|
+
log.info("#{e.count} LaTeX processing errors found in #{f.inspect}")
|
67
96
|
exit 1
|
68
97
|
end
|
69
98
|
log.info("No LaTeX processing errors found in #{f.inspect}")
|
data/features/cli.feature
CHANGED
@@ -41,6 +41,18 @@ Feature: Command Line Processing
|
|
41
41
|
\end{document}
|
42
42
|
"""
|
43
43
|
When I run bash with "pdflatex article.tex"
|
44
|
-
Then I run bin/texqc with "article"
|
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
|
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.5.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,10 +46,10 @@ 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.
|
50
|
-
s.add_development_dependency 'codecov', '0.
|
49
|
+
s.add_runtime_dependency 'slop', '~> 4.8.2'
|
50
|
+
s.add_development_dependency 'codecov', '0.2.6'
|
51
51
|
s.add_development_dependency 'cucumber', '~> 1.3.17'
|
52
|
-
s.add_development_dependency 'rake', '12.
|
52
|
+
s.add_development_dependency 'rake', '12.3.3'
|
53
53
|
s.add_development_dependency 'rubocop', '0.61.0'
|
54
54
|
s.add_development_dependency 'rubocop-rspec', '1.31.0'
|
55
55
|
end
|
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.5.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-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
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:
|
54
|
+
version: 4.8.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: codecov
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.2.6
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.2.6
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: cucumber
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - '='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 12.
|
89
|
+
version: 12.3.3
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 12.
|
96
|
+
version: 12.3.3
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rubocop
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|