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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2099f8e3d8d378158ce5b1496910bacebc2c94dc34bab46497ee2f8705a1f8de
4
- data.tar.gz: 5c9eabdcb8918403c336f983d8411a4a63ad0d14644b69169487b13b4bb294c4
3
+ metadata.gz: 19e114b82eed83d7dc3e0b0320418c89dbc0fbaf557b9886867837264c49939e
4
+ data.tar.gz: d815e0852ed6fdf217935cdc8a3340bffec993430b51064b5af1f0ef6f56080c
5
5
  SHA512:
6
- metadata.gz: 272973773f24946901bb376ff47a747cbd01adc3be02fdb077275fa18cdc96f2fe0c32a8a9ff686d835a355bdef708190ec6e9d9985cf9ffc8282ed0c0b20fd4
7
- data.tar.gz: dbbbd7523655d391f429389fbb049a6bd842c1f2a47cab12c2825ea9929fe2454b03004dbc5b18fc4e00e73aaeba129194ad15102f4731993c2fb00e9627e1d6
6
+ metadata.gz: cb0a5f84ecdc58c058ce1ba513cea2e30a9b3deadf42a342b254002f2ea911174f2b853ff05fa0a7ccfeb7ba9a62b193fbe79d51f7763311d378c273d211a914
7
+ data.tar.gz: 33e1ffc295e36868d42a345ac1522ffd5aa7fb5ea45caad133afb189fb0627bc4a222dabaadeb0376348df9c8ffa507b1cc15086de9bc53ace22e36bb2631eb6
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/.travis.yml CHANGED
@@ -10,6 +10,7 @@ addons:
10
10
  packages:
11
11
  - aspell
12
12
  - aspell-en
13
+ - texlive
13
14
  install:
14
15
  - gem install pdd -v 0.20.5
15
16
  - travis_retry bundle update
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.2.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.array '--dry', 'Don\'t fail the build on errors'
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
- errors = 0
58
- f = "#{opts.arguments[0]}.log"
59
- File.readlines(f).each do |t|
60
- if t.start_with?('Underfull ', 'Overfull ', 'LaTeX Warning: ')
61
- errors += 1
62
- puts t
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 errors.zero?
66
- log.info("#{errors} LaTeX processing errors found in #{f.inspect}")
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
@@ -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.2.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.6'
50
- s.add_development_dependency 'codecov', '0.1.10'
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.0.0'
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.2.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: 2020-08-10 00:00:00.000000000 Z
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: '4.6'
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: '4.6'
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.1.10
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.1.10
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.0.0
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.0.0
96
+ version: 12.3.3
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rubocop
99
99
  requirement: !ruby/object:Gem::Requirement