pronto-slim 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cf4171183e9f606ac12d29054166228ab91c33bf
4
+ data.tar.gz: 22937aef13c3cf9f4c13aad2da023bf8979e8404
5
+ SHA512:
6
+ metadata.gz: f4339025a774a2cfa08f2e017ad9684d9626b09de8de6980927b8ca2d3effdf7a86e09c39e34e097ae70b8d06b21ec122a28f04292360caeac985198c69e7f48
7
+ data.tar.gz: 499178cab1afe5fa6ac1b8cd92b2fdb9e1ccd1bbec59c65527551cda42e67a7ead13afca201cf51f9ac8929a38df142b776ddd92d24efe52ad720db0ec3076a9
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Thomas Nys
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # Pronto runner for SLIM-Lint
2
+
3
+ [![Code Climate](https://codeclimate.com/repos/57a5f7834b22b0768a0002a7/badges/1af5cf4491504f26b8c5/gpa.svg)](https://codeclimate.com/repos/57a5f7834b22b0768a0002a7/feed)
4
+ [![Build Status](https://travis-ci.org/nysthee/pronto-slim.svg?branch=master)](https://travis-ci.org/nysthee/pronto-slim)
5
+ [![Gem Version](https://badge.fury.io/rb/pronto-haml.png)](http://badge.fury.io/rb/pronto-haml)
6
+ [![Dependency Status](https://gemnasium.com/badges/github.com/nysthee/pronto-slim.svg)](https://gemnasium.com/github.com/nysthee/pronto-slim)
7
+
8
+ Pronto runner for [SLIM-Lint](https://github.com/sds/slim-lint), tool for writing clean and consistent SLIM. [What is Pronto?](https://github.com/mmozuras/pronto)
9
+
10
+ ## Configuration
11
+ Configuring SLIM-Lint via .slim-lint.yml will work just fine with pronto-slim.
12
+
13
+ ## Inspiration
14
+ This gem is based on [pronto-haml](https://github.com/mmozuras/pronto-haml).
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'pronto/slim'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/config/routes.rb ADDED
@@ -0,0 +1,12 @@
1
+ SLIM-Lint
2
+
3
+ [![Code Climate](https://codeclimate.com/github/mmozuras/pronto-haml.png)](https://codeclimate.com/github/mmozuras/pronto-haml)
4
+ [![Build Status](https://travis-ci.org/mmozuras/pronto-haml.png)](https://travis-ci.org/mmozuras/pronto-haml)
5
+ [![Gem Version](https://badge.fury.io/rb/pronto-haml.png)](http://badge.fury.io/rb/pronto-haml)
6
+ [![Dependency Status](https://gemnasium.com/mmozuras/pronto-haml.png)](https://gemnasium.com/mmozuras/pronto-haml)
7
+
8
+ Pronto runner for [SLIM-Lint](https://github.com/sds/slim-lint), tool for writing clean and consistent SLIM. [What is Pronto?](https://github.com/mmozuras/pronto)
9
+
10
+ ## Configuration
11
+ #
12
+ #Configuring SLIM-Lint via .slim-lint.yml will work just fine with pronto-slim.
@@ -0,0 +1,5 @@
1
+ module Pronto
2
+ module SlimLintVersion
3
+ VERSION = '0.1.0'.freeze
4
+ end
5
+ end
@@ -0,0 +1,40 @@
1
+ require 'pronto'
2
+ require 'slim_lint'
3
+
4
+ module Pronto
5
+ class Slim < Runner
6
+ def initialize(_, _ = nil)
7
+ super
8
+
9
+ @runner = ::SlimLint::Runner.new
10
+ end
11
+
12
+ def run
13
+ return [] unless @patches
14
+
15
+ @patches.select { |patch| patch.additions > 0 }
16
+ .select { |patch| haml_file?(patch.new_file_full_path) }
17
+ .map { |patch| inspect(patch) }
18
+ .flatten.compact
19
+ end
20
+
21
+ def inspect(patch)
22
+ lints = @runner.run(files: [patch.new_file_full_path.to_s]).lints
23
+ lints.map do |lint|
24
+ patch.added_lines.select { |line| line.new_lineno == lint.line }
25
+ .map { |line| new_message(lint, line) }
26
+ end
27
+ end
28
+
29
+ def new_message(lint, line)
30
+ path = line.patch.delta.new_file[:path]
31
+ Message.new(path, line, lint.severity, lint.message, nil, self.class)
32
+ end
33
+
34
+ private
35
+
36
+ def slim_file?(path)
37
+ File.extname(path) == '.slim'
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,40 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'pronto/slim/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = 'pronto-slim'
8
+ s.version = Pronto::SlimLintVersion::VERSION
9
+ s.platform = Gem::Platform::RUBY
10
+ s.authors = ['Thomas Nys']
11
+ s.email = ['nysthee@gmail.com']
12
+ s.homepage = 'https://github.com/nysthee/pronto-slim'
13
+ s.summary = 'Pronto runner for SLIM-Lint, tool for writing clean and consistent SLIM'
14
+
15
+ s.licenses = ['MIT']
16
+ s.required_ruby_version = '>= 1.9.3'
17
+ s.rubygems_version = '1.8.23'
18
+
19
+ s.files = `git ls-files`.split($RS).reject do |file|
20
+ file =~ %r{^(?:
21
+ spec/.*
22
+ |Gemfile
23
+ |Rakefile
24
+ |\.rspec
25
+ |\.gitignore
26
+ |\.rubocop.yml
27
+ |\.travis.yml
28
+ )$}x
29
+ end
30
+
31
+ s.test_files = []
32
+ s.extra_rdoc_files = ['LICENSE', 'README.md']
33
+ s.require_paths = ['lib']
34
+
35
+ s.add_runtime_dependency('pronto', '~> 0.6.0')
36
+ s.add_runtime_dependency('slim_lint', '~> 0.8.2')
37
+ s.add_development_dependency('rake', '~> 11.2.2')
38
+ s.add_development_dependency('rspec', '~> 3.4')
39
+ s.add_development_dependency('rspec-its', '~> 1.2')
40
+ end
metadata ADDED
@@ -0,0 +1,124 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pronto-slim
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Thomas Nys
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-08-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pronto
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.6.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.6.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: slim_lint
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.8.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.8.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 11.2.2
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 11.2.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.4'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.4'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-its
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.2'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.2'
83
+ description:
84
+ email:
85
+ - nysthee@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files:
89
+ - LICENSE
90
+ - README.md
91
+ files:
92
+ - LICENSE
93
+ - README.md
94
+ - bin/console
95
+ - bin/setup
96
+ - config/routes.rb
97
+ - lib/pronto/slim.rb
98
+ - lib/pronto/slim/version.rb
99
+ - pronto-slim.gemspec
100
+ homepage: https://github.com/nysthee/pronto-slim
101
+ licenses:
102
+ - MIT
103
+ metadata: {}
104
+ post_install_message:
105
+ rdoc_options: []
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 1.9.3
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ requirements: []
119
+ rubyforge_project:
120
+ rubygems_version: 2.5.1
121
+ signing_key:
122
+ specification_version: 4
123
+ summary: Pronto runner for SLIM-Lint, tool for writing clean and consistent SLIM
124
+ test_files: []