fossology / atarashi

Atarashi scans for license statements in open source software, focusing on text statistics. Designed to work stand-alone and with FOSSology.
http://fossology.github.io/atarashi
GNU General Public License v2.0
26 stars 23 forks source link

Invalid File Path in Atarashi #79

Closed codeakki closed 3 years ago

codeakki commented 3 years ago

Whenever a invaid file path is provided to atrashi it generate the following error: env) akshay@akshay-VirtualBox:~/atarashi/atarashi/evaluator$ atarashi -a tfidf Testfiles/APSL-style.html Traceback (most recent call last): File "/home/akshay/atarashi/env/bin/atarashi", line 8, in

sys.exit(main())

File "/home/akshay/atarashi/env/lib/python3.8/site-packages/atarashi/atarashii.py", line 123, in main result = atarashii_runner(inputFile, processedLicense, agent_name, similarity, ngram_json, verbose) File "/home/akshay/atarashi/env/lib/python3.8/site-packages/atarashi/atarashii.py", line 83, in atarashii_runner result = scanner.scan(inputFile) File "/home/akshay/atarashi/env/lib/python3.8/site-packages/atarashi/agents/tfidf.py", line 140, in scan return self.tfidfcosinesim(filePath) File "/home/akshay/atarashi/env/lib/python3.8/site-packages/atarashi/agents/tfidf.py", line 112, in tfidfcosinesim processedData1 = super().loadFile(inputFile) File "/home/akshay/atarashi/env/lib/python3.8/site-packages/atarashi/agents/atarashiAgent.py", line 44, in loadFile self.commentFile = CommentPreprocessor.extract(filePath) File "/home/akshay/atarashi/env/lib/python3.8/site-packages/atarashi/libs/commentPreprocessor.py", line 129, in extract data1 = licenseComment(data) File "/home/akshay/atarashi/env/lib/python3.8/site-packages/atarashi/libs/commentPreprocessor.py", line 42, in licenseComment for id, item in enumerate(data[0]["multi_line_comment"]): IndexError: list index out of range (env) akshay@akshay-VirtualBoxatarashi/atarashi/evaluator$

### Instead It should Generate a simple error msg that the file path that was provided was wrong

Aman-Codes commented 3 years ago

Hi @codeakki are you working on it right now ? If not I would like to work on this issue. @Gmishx I wanted to know that whether the check for valid file path is to be added only in atarahii.py file #L83 or inside the scan function of each agent (like here). The latter option also takes takes into account the case when an individual agent file is called from main.

GMishx commented 3 years ago

@GMishx I wanted to know that whether the check for valid file path is to be added only in atarahii.py file #L83 or inside the scan function of each agent (like here). The latter option also takes takes into account the case when an individual agent file is called from main.

Doing the path check in the atarashii.py will be a better option as the directory handling should also be done in the same location.

Aman-Codes commented 3 years ago

Doing the path check in the atarashii.py will be a better option as the directory handling should also be done in the same location.

Yeah Sounds Good

codeakki commented 3 years ago

@Aman-Codes Yeah for sure u can work on this issue.I'm. currently working on some other issue.