xlint 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +108 -6
- data/lib/xlint.rb +1 -1
- data/lib/xlint/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57464a500839faac4d71aa2b0d125969425b93f4
|
4
|
+
data.tar.gz: 411c8fa3c67ba1598aaa3d82b844ec79cf1d58b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be05a32d2196a4c2ba9f53e6d1da93e98afb65b4d9ece44d88557fcdc1f4665e3a27181a29a10a5821ab5e2a477a6bdd035855a4642fac419985433410b9b26b
|
7
|
+
data.tar.gz: 321dcddf0ed6b695cd4209ef2e5ac92c06a8e921cf1be28f8a833be9f469ef8b1c8b0a804e9e6e3cb1e17920473825adffa97a52b7c0c998c081e5dec8aa8258
|
data/README.md
CHANGED
@@ -18,14 +18,14 @@ in the Gerrit review.
|
|
18
18
|
Xlint parses the changes in a patchset, and runs each change through
|
19
19
|
a validator. If the validator detects any issues, a [Gergich](https://rubygems.org/gems/gergich)
|
20
20
|
comment is created. After all the changes have been checked, Xlint
|
21
|
-
publishes the Gergich comments to Gerrit.
|
21
|
+
publishes the Gergich comments to Gerrit. If the CI environment has a variable for a Gerrit review label, Xlint will also post a reply to the label.
|
22
22
|
|
23
23
|
## Limitations
|
24
24
|
|
25
25
|
Xlint currently only detects changes to the deployment target within
|
26
26
|
Xcode .pbxproj files.
|
27
27
|
|
28
|
-
## Installation
|
28
|
+
## Installation and Usage
|
29
29
|
|
30
30
|
[Gergich][gergich] and Gerrit must be configured as defined in the Gergich gem. If
|
31
31
|
[Gergich][gergich] works, then all you need to do is `gem install xlint` and Xlint
|
@@ -33,14 +33,116 @@ is ready for linting.
|
|
33
33
|
|
34
34
|
[gergich]: https://github.com/instructure/gergich
|
35
35
|
|
36
|
-
|
36
|
+
### Setup Gerrit and Gergich Environment Variables on Jenkins
|
37
|
+
* Install EnvInject Jenkins Plugin (Manage Jenkins > Manage Plugins > Available Filter: EnvInject)
|
38
|
+
Note: The Jenkins version on Cloudbees does not currently work with EnvInject.
|
39
|
+
* Add the following Global property (Jenkins Configuration > Global Properties)
|
37
40
|
|
38
|
-
|
39
|
-
|
41
|
+
> GERGICH_KEY
|
42
|
+
```
|
43
|
+
Name: GERGICH_KEY
|
44
|
+
Value: <access_key_for_gergich_user_on_gerrit>
|
45
|
+
```
|
46
|
+
|
47
|
+
* Check "This project is parameterized" (Job Configuration > General)
|
48
|
+
* Add the following String Parameters to (Job Configuration > General
|
49
|
+
|
50
|
+
> GERRIT_REFSPEC
|
51
|
+
```
|
52
|
+
Name: GERRIT_REFSPEC
|
53
|
+
Default Value: HEAD:refs/for
|
54
|
+
```
|
55
|
+
|
56
|
+
> GERRIT_BRANCH
|
57
|
+
```
|
58
|
+
Name: GERRIT_BRANCH
|
59
|
+
Default Value: develop
|
60
|
+
```
|
40
61
|
|
41
|
-
|
62
|
+
> GERGICH_REVIEW_LABEL
|
63
|
+
```
|
64
|
+
Name: GERGICH_REVIEW_LABEL
|
65
|
+
Default Value: Lint-Review
|
66
|
+
```
|
42
67
|
|
68
|
+
* Check "Inject environment variables to the build process" (Job Configuration > Build Environment)
|
69
|
+
|
70
|
+
### Setup Lint-Review on Gerrit
|
71
|
+
In the meta/config branch of your Gerrit project, you need to add "Linter Bots" to your groups file, create the Lint-Review label, and grant access to bots in the project.config file.
|
72
|
+
|
73
|
+
> groups
|
74
|
+
```
|
75
|
+
# UUID Group Name
|
76
|
+
#
|
77
|
+
<uuid_for_developers_group> Developers
|
78
|
+
<uuid_for_robots_group> Robots
|
79
|
+
<uuid_for_administrators_group> Administrators
|
80
|
+
<uuid_for_linter_bots_group> Linter Bots
|
43
81
|
```
|
82
|
+
|
83
|
+
> project.config
|
84
|
+
```
|
85
|
+
[access "refs/*"]
|
86
|
+
owner = group Administrators
|
87
|
+
owner = group Developers
|
88
|
+
read = group Robots
|
89
|
+
[label "Lint-Review"]
|
90
|
+
function = AnyWithBlock
|
91
|
+
abbreviation = L
|
92
|
+
value = -2 Error
|
93
|
+
value = -1 Warning
|
94
|
+
value = 0 No score
|
95
|
+
value = +1 Verified
|
96
|
+
defaultValue = 0
|
97
|
+
[access "refs/heads/*"]
|
98
|
+
label-Lint-Review = -2..1 group Linter Bots
|
99
|
+
```
|
100
|
+
|
101
|
+
* For additional information on Gerrit project labels, [review the Gerrit documentation](https://gerrit-review.googlesource.com/Documentation/config-labels.html)
|
102
|
+
|
103
|
+
* How do I checkout, commit, and push to the meta/config branch?
|
104
|
+
* ``` git fetch origin refs/meta/config:refs/remotes/origin/meta/config ```
|
105
|
+
* ``` git checkout meta/config ```
|
106
|
+
* ``` git add project.config ```
|
107
|
+
* ``` git commit -m "add Lint-Review" ```
|
108
|
+
* ``` git push origin HEAD:refs/meta/config ```
|
109
|
+
|
110
|
+
### Setup Xlint to Run in Jenkins Job
|
111
|
+
Add the following to build script (Job Configuration > Build > Execute Shell > Command)
|
112
|
+
``` bash
|
113
|
+
#!/bin/bash --login
|
114
|
+
|
115
|
+
ruby -v
|
116
|
+
|
117
|
+
if ! gem list xlint -i; then
|
118
|
+
gem install --no-document xlint
|
119
|
+
else
|
120
|
+
gem update xlint
|
121
|
+
fi
|
122
|
+
|
44
123
|
git diff HEAD~1 HEAD > changes.diff
|
45
124
|
xlint changes.diff
|
125
|
+
|
126
|
+
# if using Fastlane
|
127
|
+
# fastlane lint
|
128
|
+
|
129
|
+
echo ''
|
130
|
+
echo 'Gergich Status:'
|
131
|
+
gergich status
|
132
|
+
```
|
133
|
+
|
134
|
+
Add a lint lane to Fastlane:
|
135
|
+
``` ruby
|
136
|
+
desc 'Xlint'
|
137
|
+
lane :lint do
|
138
|
+
if ENV['GERRIT_PROJECT']
|
139
|
+
changes_diff = 'changes.diff'
|
140
|
+
sh "git diff HEAD~1 HEAD > #{changes_diff}"
|
141
|
+
begin
|
142
|
+
sh "xlint #{changes_diff}"
|
143
|
+
ensure
|
144
|
+
File.delete(changes_diff) if File.exists?(changes_diff)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
46
148
|
```
|
data/lib/xlint.rb
CHANGED
data/lib/xlint/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xlint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taylor Wilson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -291,8 +291,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
291
291
|
version: '0'
|
292
292
|
requirements: []
|
293
293
|
rubyforge_project:
|
294
|
-
rubygems_version: 2.6.
|
294
|
+
rubygems_version: 2.6.4
|
295
295
|
signing_key:
|
296
296
|
specification_version: 4
|
297
297
|
summary: Command-line tool for linting Xcode project files.
|
298
298
|
test_files: []
|
299
|
+
has_rdoc:
|