@dxworks/insider 0.0.1-test
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.
- package/README.md +89 -0
- package/TODO.txt +7 -0
- package/dxworks-site.json +13 -0
- package/gradle.properties +0 -0
- package/lib/index.js +13 -0
- package/lib/insider.js +7 -0
- package/lib/lib.js +21 -0
- package/lombok.config +2 -0
- package/package.json +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Insider
|
|
2
|
+
|
|
3
|
+
Insider is a belt of tools built on the idea of searching regular expressions in code. Insider is able to detect code
|
|
4
|
+
smells, the usage of external libraries and the topics that a software project approaches by only using Regex. This
|
|
5
|
+
means that Insider does not use any type of parsing and is therefore language independent.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
### From Github
|
|
10
|
+
|
|
11
|
+
To install Insider from Github, please download from the [latest release](https://github.com/dxworks/insider/releases)
|
|
12
|
+
from Github, the `insider.zip` archive and unzip it to a specific location. The contents of this archive are:
|
|
13
|
+
|
|
14
|
+
* `insider-*.jar` - the executable jar file
|
|
15
|
+
* `insider.bat` - a batch script for executing Insider on Windows
|
|
16
|
+
* `insider.sh` - a shell script for executing insider on Windows
|
|
17
|
+
* `config` - a folder for configuration files, described more in the [Configuration Section](#Configuration)
|
|
18
|
+
* `results` - a folder where Insider will output the results.
|
|
19
|
+
|
|
20
|
+
### From Docker
|
|
21
|
+
|
|
22
|
+
...
|
|
23
|
+
|
|
24
|
+
### From Code
|
|
25
|
+
|
|
26
|
+
Clone the repository from [here](https://github.com/dxworks/insider).
|
|
27
|
+
|
|
28
|
+
Run `gradle clean build` to obtain an executable jar.
|
|
29
|
+
|
|
30
|
+
## Configuration
|
|
31
|
+
|
|
32
|
+
Edit the configuration file (*config/insider-conf.properties*), to **specify the root folder** of the project's sources.
|
|
33
|
+
|
|
34
|
+
## Commands
|
|
35
|
+
|
|
36
|
+
### Find Command
|
|
37
|
+
|
|
38
|
+
* In order to find the occurrences of the libraries in the analyzed project. Use the following command (run Insider
|
|
39
|
+
using the **insider.bat** or **insider.sh** script):
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
insider.sh find config/libraries.json
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
* Detect Simple Code Smells. Use the following command (run Insider using the **insider.bat** or **insider.sh** script):
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
insider.sh find config/code_smells.json
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
* You can also run the *find* command with both files at once:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
insider.sh find config/libraries.json config/code_smells.json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The commands will generate two *.json* files (**_PROJECT_ID-libraries.json_** and **_PROJECT_ID-code_smells.json_**) in
|
|
58
|
+
the **results** folder.
|
|
59
|
+
|
|
60
|
+
## Voyager Integration
|
|
61
|
+
|
|
62
|
+
Insider is also a Voyager Instrument. To configure Insider from Voyager you can add the following fields in the `mission.yml` file:
|
|
63
|
+
|
|
64
|
+
```yaml
|
|
65
|
+
# A map of instrument names to commands and parameters.
|
|
66
|
+
# When 'runsAll' is false the mission will run only the instruments
|
|
67
|
+
# with the commands declared here, in this order.
|
|
68
|
+
instruments:
|
|
69
|
+
insider:
|
|
70
|
+
# A map of parameter name to value
|
|
71
|
+
# Only add the parameters you want to override (the default values are written here)
|
|
72
|
+
parameters:
|
|
73
|
+
max-heap: 4g # will configure the maximum heap space the jvm process will get. For large process may be needed to be set to 16g or higher
|
|
74
|
+
findConfig: 'config/fingerprints/code_smells.json config/fingerprints/libraries.json' # a space separated list of insider fingerprints
|
|
75
|
+
inspectConfig: 'config/rules' # a space separated list of folders or Application Inspector specific rules, like the ones here: https://github.com/microsoft/ApplicationInspector/tree/main/AppInspector/rules/default
|
|
76
|
+
|
|
77
|
+
# A map of environment variables, name to value, for voyager missions
|
|
78
|
+
# overwrites the variables from global config, instrument and command
|
|
79
|
+
# Only set the environment variables you need.
|
|
80
|
+
environment:
|
|
81
|
+
INSIDER_LANGUAGES: 'java,c++,c#' # a comma separated list of the languages to analyse (just a sample example)
|
|
82
|
+
INSIDER_LINGUIST_FILE: "${instrument}/languages.yml" # a file containing languages to extension mappings according to [GitHub Linguist](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml)
|
|
83
|
+
INSIDER_DEPEXT_MAX_NAMESPACE_LENGTH: 200 # the maximum length of a namespace for DepExt analysis
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Acknowledgements
|
|
87
|
+
|
|
88
|
+
The `inspect` command is inspired by the [Application Inspector](https://github.com/microsoft/ApplicationInspector)
|
|
89
|
+
project created by Microsoft. Insider even uses the same input files as Application Inspector.
|
package/TODO.txt
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"displayName": "Insider",
|
|
3
|
+
"description": "A tool that uses regular expressions to scan code smells, find dependencies between code entities, and detect topics used in a system",
|
|
4
|
+
"relevance": 1,
|
|
5
|
+
"categories": ["tool"],
|
|
6
|
+
"codeOwners": [
|
|
7
|
+
{
|
|
8
|
+
"name": "Mario Rivis"
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"technologies": ["java", "gradle"],
|
|
12
|
+
"docs": "https://dxworks.github.io/insider"
|
|
13
|
+
}
|
|
File without changes
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const {insider} = require("./lib");
|
|
2
|
+
const {Command} = require("commander");
|
|
3
|
+
|
|
4
|
+
exports.insiderCommand = new Command()
|
|
5
|
+
.name('insider')
|
|
6
|
+
.description('Running Insider commands')
|
|
7
|
+
.option('-wd --working-directory', 'Selects the directory where Insider will store the results folder.' +
|
|
8
|
+
` Defaults to the location where Insider is installed: ${__dirname}. If set to true it will use the current working directory process.cwd()`,
|
|
9
|
+
false)
|
|
10
|
+
.allowUnknownOption()
|
|
11
|
+
.action(insider)
|
|
12
|
+
|
|
13
|
+
|
package/lib/insider.js
ADDED
package/lib/lib.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const {JavaCaller} = require('java-caller');
|
|
2
|
+
|
|
3
|
+
async function insider(options) {
|
|
4
|
+
const java = new JavaCaller({
|
|
5
|
+
jar: 'insider.jar', // CLASSPATH referencing the package embedded jar files
|
|
6
|
+
mainClass: 'org.dxworks.insider.Insider',// Main class to call, must be available from CLASSPATH,
|
|
7
|
+
rootPath: __dirname,
|
|
8
|
+
minimumJavaVersion: 11,
|
|
9
|
+
output: 'console'
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const args = [...process.argv];
|
|
13
|
+
let index = args.indexOf('insider'); //if it is called from dxw cli
|
|
14
|
+
if(index === -1)
|
|
15
|
+
index = 1
|
|
16
|
+
args.splice(0, index + 1);
|
|
17
|
+
const {status} = await java.run(args, {cwd: options?.workingDirectory? process.cwd(): __dirname});
|
|
18
|
+
process.exitCode = status;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = {insider}
|
package/lombok.config
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dxworks/insider",
|
|
3
|
+
"version": "0.0.1-test",
|
|
4
|
+
"description": "Insider is a belt of tools built on the idea of searching regular expressions in code",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"insider",
|
|
7
|
+
"java",
|
|
8
|
+
"regex"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/dxworks/insider#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/dxworks/insider/issues"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/dxworks/insider.git"
|
|
17
|
+
},
|
|
18
|
+
"license": "Apache-2.0",
|
|
19
|
+
"author": "Mario Rivis",
|
|
20
|
+
"main": "dist/index.js",
|
|
21
|
+
"bin": {
|
|
22
|
+
"insider": "dist/insider.js"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "npm run clean && mkdir dist && cp lib/*.js dist && cp build/libs/insider*.jar dist/insider.jar && npm run copy-assets",
|
|
26
|
+
"copy-assets": "cp -R config dist/config",
|
|
27
|
+
"clean": "rimraf dist/",
|
|
28
|
+
"local": "npm run build && npm i"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"commander": "11.1.0",
|
|
32
|
+
"java-caller": "^2.7.0"
|
|
33
|
+
},
|
|
34
|
+
"overrides": {
|
|
35
|
+
"tar": "^7.5.11"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"json": "^11.0.0",
|
|
39
|
+
"rimraf": "^3.0.2",
|
|
40
|
+
"sort-package-json": "^1.52.0"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"dxw": {
|
|
46
|
+
"commands": [
|
|
47
|
+
{
|
|
48
|
+
"file": "dist/index.js",
|
|
49
|
+
"command": "insiderCommand"
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}
|