jscop 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +22 -21
- data/lib/classes/js_parser.rb +1 -2
- data/lib/jscop/unused_var_checker.rb +1 -1
- data/lib/jscop/version.rb +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: abb0cad990ebb8f7f6463cc90de10b29216c018b946b58bf1f1892552f05b6f6
|
4
|
+
data.tar.gz: 7ed4516878c43730b8cf84c111b06a6c7dfb23117d67bc7ae1788083ecbc3324
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb84608dfa279d4090baaa5eea9edf033ae025c0f2598f4348baba29ee4bc3af4070125723741ad792ef3b2d8d54528fd47fa9816ac200844e1bad048a302a22
|
7
|
+
data.tar.gz: 8d2a698f9ddd968e40e5bc939252baf5526f29b717029bd7723729af48fcb4e473a98bfa71dbf2876190d53cb2025c5ffa0c386a8b1a5ce48faf7b18a983d8b2
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,25 @@
|
|
1
|
-
[![Gem Version](https://badge.fury.io/rb/jscop.svg)](https://badge.fury.io/rb/jscop) [![Build Status](https://travis-ci.org/codecell/jscop.svg?branch=development)](https://travis-ci.org/codecell/jscop)
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/jscop.svg)](https://badge.fury.io/rb/jscop) [![Build Status](https://travis-ci.org/codecell/jscop.svg?branch=development)](https://travis-ci.org/codecell/jscop)
|
2
2
|
|
3
3
|
# Jscop
|
4
4
|
|
5
5
|
This is a Linter for checking errors in Javascript code, built with Ruby.
|
6
6
|
|
7
|
+
## Outline
|
8
|
+
- [Installation](#Installation)
|
9
|
+
- [Usage](#Usage)
|
10
|
+
- [Errors currently detectable by jscop](#ERRORS)
|
11
|
+
- Variable naming errors
|
12
|
+
- Class naming errors
|
13
|
+
- Extra or redundant spacing errors
|
14
|
+
- Multiple declaration of classes in a file (class count) errors
|
15
|
+
- Unused variables are detected
|
16
|
+
- [More about usage](#More-About-Usage)
|
17
|
+
- [Testing this repo](#Testing-This-Repo)
|
18
|
+
- [Built With](#Built-With)
|
19
|
+
- [Contributing](#contributing)
|
20
|
+
- [Code of conduct](#Code-of-Conduct)
|
21
|
+
- [Licence](#License)
|
22
|
+
|
7
23
|
## Installation
|
8
24
|
|
9
25
|
Add this line to your application's Gemfile:
|
@@ -29,22 +45,8 @@ b. jscop ./**/path_to_file.js # To lint JUST a specific file.
|
|
29
45
|
c. jscop foldername # To lint all *.js files in a specific folder.
|
30
46
|
```
|
31
47
|
|
32
|
-
##
|
33
|
-
|
34
|
-
- Errors currently detectable by jscop
|
35
|
-
- Variable naming errors
|
36
|
-
- Class naming errors
|
37
|
-
- Extra or redundant spacing errors
|
38
|
-
- Multiple declaration of classes in a file (class count) errors
|
39
|
-
- Unused variables are detected
|
40
|
-
- Arguments supported to initiate linting
|
41
|
-
- Testing this repo
|
42
|
-
- Unit tests
|
43
|
-
- Tools used
|
44
|
-
- Code of conduct
|
45
|
-
- Contributing
|
46
|
-
|
47
|
-
## ERRORS that can currently be detected include
|
48
|
+
## ERRORS
|
49
|
+
The following erros are currently detectable by Jscop:
|
48
50
|
|
49
51
|
### VARIABLE NAMING ERRORS
|
50
52
|
- if capital letters or numbers are used to start a variable name, e.g
|
@@ -72,20 +74,19 @@ c. jscop foldername # To lint all *.js files in a specific folder.
|
|
72
74
|
- if a variable (var, let, const) is defined and never used.
|
73
75
|
- A lot of edge cases are covered here.
|
74
76
|
|
75
|
-
##
|
77
|
+
## More About Usage
|
78
|
+
Arguments Supported By jscop to Check Javascript Code
|
76
79
|
- You can pass in file(s) or a folder in any of the following cases in your terminal
|
77
80
|
- `You can pass in a specific file $Path to test just the file`
|
78
81
|
- `You can pass in a folder and all javascript files in it will be checked and finally`
|
79
82
|
- `Everything Js can be linted all at once (both files and folders)`
|
80
83
|
|
81
|
-
## Testing
|
84
|
+
## Testing this Repo
|
82
85
|
- Once in the $Path you intend to keep this project in the terminal of your machine
|
83
86
|
- Clone with this command `git clone [repo](https://github.com/codecell/jscop.git)`
|
84
87
|
- Change directory into the folder `cd jscop`
|
85
88
|
- Install project dependencies with the command `bundle install`
|
86
89
|
- You can make the `exe/jscop` file executable with the command `chmod a+x exe/jscop` if permission is not granted
|
87
|
-
|
88
|
-
## Unit Tests
|
89
90
|
- Ensure you have `rspec` installed, or ensure that `gem rspec` is listed among the gems in the `Gemfile` => then run `bundle install`
|
90
91
|
- In the console, run `rspec` or `rake` to run all the unit tests written for this project
|
91
92
|
|
data/lib/classes/js_parser.rb
CHANGED
@@ -11,11 +11,10 @@ class JsParser
|
|
11
11
|
|
12
12
|
def set_lines
|
13
13
|
file = File.open(@filename)
|
14
|
-
|
15
14
|
all_lines = file.readlines.map(&:chomp)
|
16
15
|
init_lines = lambda { |val, index|
|
17
16
|
line = Line.new(index + 1, val, @filename)
|
18
|
-
@lines << line
|
17
|
+
@lines << line if !line.filename.match?(/(node_modules)/)
|
19
18
|
}
|
20
19
|
|
21
20
|
all_lines.each_with_index(&init_lines)
|
@@ -17,7 +17,7 @@ module UnusedVarChecker
|
|
17
17
|
def self.check_escapable(elem)
|
18
18
|
escapables = [
|
19
19
|
'', 'var', 'let', 'const', 'constructor', 'class', 'super', 'function', 'static', 'console',
|
20
|
-
'prototype', 'get', 'set', 'this', 'alert', 'prompt',
|
20
|
+
'prototype', 'get', 'set', 'this', 'alert', 'prompt', 'return',
|
21
21
|
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'
|
22
22
|
]
|
23
23
|
|
data/lib/jscop/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jscop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ezaka Alfred
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
|
-
rubygems_version: 3.
|
139
|
+
rubygems_version: 3.1.4
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: A linter for checking errors in javascript code
|