Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SPDX-License-Identifier: Apache-2.0
-->
<p align='right'>
<a href="https://github.com/fosslight/fosslight_source/blob/main/docs/README_Kor.md">
[Kor]
[Korean]
</a>
</p>

Expand Down Expand Up @@ -53,30 +53,30 @@ $ pip3 install fosslight_source
There are two commands for FOSSLight Scanner.

### 1. fosslight_source
After executing ScanCode, the source code scanner, print the OSS Report.
After executing ScanCode, the source code scanner, print the FOSSLight Report.

| Parameter | Argument | Description |
| ------------- | ------------- | ------------- |
| h | None | Print help message. |
| p | String | Path to detect source. |
| j | None | As an output, the result of executing ScanCode in json format other than OSS Report is additionally generated. |
| j | None | As an output, the result of executing ScanCode in json format other than FOSSLight Report is additionally generated. |
| o | String | Output file name without file extension. |

#### Ex. Print result to OSS Report and json file
#### Ex. Print result to FOSSLight Report and json file
```
$ fosslight_source -p /home/source_path -j
```

### 2. fosslight_convert
Converts the result of executing ScanCode in json format into OSS Report format.
Converts the result of executing ScanCode in json format into FOSSLight Report format.

| Parameter | Argument | Description |
| ------------- | ------------- | ------------- |
| h | None | Print help message. |
| p | String | Path of ScanCode json files. |
| o | String | Output file name without file extension. |

#### Ex. Converting scancode json result to OSS report
#### Ex. Converting scancode json result to FOSSLight report
```
$ fosslight_convert -p /home/jsonfile_dir
```
Expand All @@ -86,14 +86,14 @@ $ fosslight_convert -p /home/jsonfile_dir
```
$ tree
.
├── OSS-Report_2021-05-03_00-39-49.csv
├── OSS-Report_2021-05-03_00-39-49.xlsx
├── FOSSLight-Report_2021-05-03_00-39-49.csv
├── FOSSLight-Report_2021-05-03_00-39-49.xlsx
├── scancode_2021-05-03_00-39-49.json
└── fosslight_src_log_2021-05-03_00-39-49.txt

```
- OSS-Report_[datetime].xlsx : FOSSLight Source result in OSS Report format.
- OSS-Report_[datetime].csv : FOSSLight Source result in csv format. (Except Windows)
- FOSSLight-Report_[datetime].xlsx : FOSSLight Source result in OSS Report format.
- FOSSLight-Report_[datetime].csv : FOSSLight Source result in csv format. (Except Windows)
- fosslight_src_log_[datetime].txt : The execution log.
- scancode_[datetime].json : The ScanCode result in case of -j option.

Expand Down
20 changes: 10 additions & 10 deletions docs/README_Kor.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align='right'>
<a href="https://github.com/fosslight/fosslight_source/blob/main/README.md">
[Eng]
[English]
</a>
</p>

Expand Down Expand Up @@ -48,29 +48,29 @@ $ pip3 install fosslight_source
FOSSLight Scanner에는 하기 두 가지 명령어가 있습니다.

### 1. fosslight_source
Source Code 분석을 실행한 후 OSS Report 형식으로 출력합니다.
Source Code 분석을 실행한 후 FOSSLight Report 형식으로 출력합니다.

| Parameter | Argument | Description |
| ------------- | ------------- | ------------- |
| h | None | Print help message. |
| p | String | Path to analyze source. |
| j | None | As an output, the result of executing ScanCode in json format other than OSS Report is additionally generated. |
| j | None | As an output, the result of executing ScanCode in json format other than FOSSLight Report is additionally generated. |
| o | String | Output file name without file extension. |

#### Ex. Source Code 분석 후 OSS Report와 json 형태의 ScanCode 결과 출력
#### Ex. Source Code 분석 후 FOSSLight Report와 json 형태의 ScanCode 결과 출력
```
$ fosslight_source -p /home/source_path -j
```
### 2. fosslight_convert
json형태인 ScanCode 결과를 OSS Report 형식으로 변환합니다.
json형태인 ScanCode 결과를 FOSSLight Report 형식으로 변환합니다.

| Parameter | Argument | Description |
| ------------- | ------------- | ------------- |
| h | None | Print help message. |
| p | String | Path of ScanCode json files. |
| o | String | Output file name without file extension. |

#### Ex. json 형태의 ScanCode 결과를 OSS Report 형식으로 변환
#### Ex. json 형태의 ScanCode 결과를 FOSSLight Report 형식으로 변환
```
$ fosslight_convert -p /home/jsonfile_dir
```
Expand All @@ -80,14 +80,14 @@ $ fosslight_convert -p /home/jsonfile_dir
```
$ tree
.
├── OSS-Report_2021-05-03_00-39-49.csv
├── OSS-Report_2021-05-03_00-39-49.xlsx
├── FOSSLight-Report_2021-05-03_00-39-49.csv
├── FOSSLight-Report_2021-05-03_00-39-49.xlsx
├── scancode_2021-05-03_00-39-49.json
└── fosslight_src_log_2021-05-03_00-39-49.txt

```
- OSS-Report_[datetime].xlsx : OSS Report형태의 Source Code 분석 결과
- OSS-Report_[datetime].csv : OSS Report를 csv로 출력한 결과 (Windows 제외)
- FOSSLight-Report_[datetime].xlsx : FOSSLight Report형태의 Source Code 분석 결과
- FOSSLight-Report_[datetime].csv : FOSSLight Report를 csv로 출력한 결과 (Windows 제외)
- fosslight_src_log_[datetime].txt: 실행 로그가 저장된 파일
- scancode_[datetime].json : ScanCode 실행 결과 (fosslight_source명령어에 -j 옵션이 포함된 경우에만 생성)

Expand Down
2 changes: 1 addition & 1 deletion src/fosslight_source/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
_HELP_MESSAGE_CONVERT = """
Usage: fosslight_convert [option1] <arg1> [option2] <arg2>...

FOSSLigtht_convert converts the result of executing ScanCode in json format into OSS Report format.
FOSSLigtht_convert converts the result of executing ScanCode in json format into FOSSLight Report format.

Options:
Mandatory
Expand Down
4 changes: 2 additions & 2 deletions src/fosslight_source/convert_scancode.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def convert_json_to_excel(scancode_json, excel_name):
success_to_write, writing_msg = write_excel_and_csv(excel_name, sheet_list)
logger.info("Writing excel :" + str(success_to_write) + " " + writing_msg)
if success_to_write:
_result_log["OSS Report"] = excel_name + ".xlsx"
_result_log["FOSSLight Report"] = excel_name + ".xlsx"

except Exception as ex:
success = False
Expand Down Expand Up @@ -112,7 +112,7 @@ def main():

if output_file_name == "":
output_dir = os.getcwd()
oss_report_name = "OSS-Report_" + start_time
oss_report_name = "FOSSLight-Report_" + start_time
else:
oss_report_name = output_file_name
output_dir = os.path.dirname(os.path.abspath(output_file_name))
Expand Down
4 changes: 2 additions & 2 deletions src/fosslight_source/run_scancode.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def run_scan(path_to_scan, output_file_name="",
start_time = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')

if output_file_name == "":
output_file = "OSS-Report_" + start_time
output_file = "FOSSLight-Report_" + start_time
output_json_file = "scancode_" + start_time
output_dir = os.getcwd()
else:
Expand Down Expand Up @@ -125,7 +125,7 @@ def run_scan(path_to_scan, output_file_name="",
output_file, sheet_list)
logger.info("Writing excel :" + str(success_to_write) + " " + writing_msg)
if success_to_write:
_result_log["OSS Report"] = output_file + ".xlsx"
_result_log["FOSSLight Report"] = output_file + ".xlsx"
except Exception as ex:
success = False
msg = str(ex)
Expand Down
4 changes: 2 additions & 2 deletions tests/cli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ def main():
start_time = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
output_file_name = ""

oss_report_name = "test_result_func_call/result"
fosslight_report_name = "test_result_func_call/result"
output_dir = os.path.dirname(os.path.abspath(output_file_name))

logger = init_log(os.path.join(output_dir, "fosslight_src_log_"+start_time+".txt"))

ret = run_scan(path_to_find_bin, oss_report_name, True, -1, True)
ret = run_scan(path_to_find_bin, fosslight_report_name, True, -1, True)

logger.warn("[Scan] Result: %s" % (ret[0]))
logger.warn("[Scan] Result_msg: %s" % (ret[1]))
Expand Down
34 changes: 22 additions & 12 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ skipdist = true
install_command = pip install {opts} {packages}
basepython= python3.6
whitelist_externals = cat
setenv =
PYTHONPATH=.

[flake8]
max-line-length = 130
Expand All @@ -18,18 +20,26 @@ filterwarnings = ignore::DeprecationWarning

[testenv:test_run]
deps =
-r{toxinidir}/requirements-dev.txt
-r{toxinidir}/requirements.txt
commands =
fosslight_source -p tests/test_files -j -o test_scan/scan_result
cat test_scan/scan_result.csv
fosslight_convert -p tests/json_result/scan_has_error.json -o test_convert/convert_result2
fosslight_convert -p test_scan/scan_result.json -o test_convert/convert_result
cat test_convert/convert_result.csv
python tests/cli_test.py

setenv =
PYTHONPATH=.
[testenv:release]
deps =
-r{toxinidir}/requirements-dev.txt

commands =
fosslight_source -h
fosslight_convert -h
fosslight_source -p tests/test_files -j -o test_scan/scan_result
cat test_scan/scan_result.csv
fosslight_convert -p tests/json_result/scan_has_error.json -o test_convert/convert_result2
fosslight_convert -p test_scan/scan_result.json -o test_convert/convert_result
cat test_convert/convert_result.csv
python tests/cli_test.py
pytest -v --flake8
fosslight_source -h
fosslight_convert -h
fosslight_source -p tests/test_files -j -o test_scan/scan_result
cat test_scan/scan_result.csv
fosslight_convert -p tests/json_result/scan_has_error.json -o test_convert/convert_result2
fosslight_convert -p test_scan/scan_result.json -o test_convert/convert_result
cat test_convert/convert_result.csv
python tests/cli_test.py
pytest -v --flake8