chaoss / grimoirelab-graal

A Generic Repository AnALyzer
GNU General Public License v3.0
23 stars 62 forks source link

[cocom] Analysis fail : invalid literal for int() with base 10 #57

Open florentk opened 5 years ago

florentk commented 5 years ago

I got this error when analyse somes of our repositories.

Example of Traceback :

2019-08-17 08:43:51,370 Analysis failed at 5c7cf2756aed68171f7350bb8d80a0fed37162e9
2019-08-17 08:43:51,370 Error feeding ocean from cocom (https://github.com/kiwix/web): invalid literal for int() with base 10: 'File'
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/grimoire_elk/elk.py", line 228, in feed_backend
    ocean_backend.feed(**params)
  File "/usr/local/lib/python3.5/dist-packages/grimoire_elk/raw/elastic.py", line 228, in feed
    self.feed_items(items)
  File "/usr/local/lib/python3.5/dist-packages/grimoire_elk/raw/elastic.py", line 244, in feed_items
    for item in items:
  File "/usr/local/lib/python3.5/dist-packages/perceval/backend.py", line 161, in fetch
    for item in self.fetch_items(category, **kwargs):
  File "/usr/local/lib/python3.5/dist-packages/graal/graal.py", line 183, in fetch_items
    raise e
  File "/usr/local/lib/python3.5/dist-packages/graal/graal.py", line 176, in fetch_items
    commit['analysis'] = self._analyze(commit)
  File "/usr/local/lib/python3.5/dist-packages/graal/backends/core/cocom.py", line 189, in _analyze
    file_info = self.analyzer.analyze(local_path)
  File "/usr/local/lib/python3.5/dist-packages/graal/backends/core/cocom.py", line 242, in analyze
    cloc_analysis = self.cloc.analyze(**kwargs)
  File "/usr/local/lib/python3.5/dist-packages/graal/backends/core/analyzers/cloc.py", line 128, in analyze
    results = self.__analyze_file(message)
  File "/usr/local/lib/python3.5/dist-packages/graal/backends/core/analyzers/cloc.py", line 58, in __analyze_file
    blank_lines = int(info_file[2])
ValueError: invalid literal for int() with base 10: 'File'

or :

2019-08-17 10:43:35,881 Analysis failed at c6ee59a8e1acf65b7931534c9613bf6c5c23909c
2019-08-17 10:43:35,881 Error feeding ocean from cocom (https://github.com/kiwix/kiwix-android): invalid literal for int() with base 10: 'Shell'
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/grimoire_elk/elk.py", line 228, in feed_backend
    ocean_backend.feed(**params)
  File "/usr/local/lib/python3.5/dist-packages/grimoire_elk/raw/elastic.py", line 228, in feed
    self.feed_items(items)
  File "/usr/local/lib/python3.5/dist-packages/grimoire_elk/raw/elastic.py", line 244, in feed_items
    for item in items:
  File "/usr/local/lib/python3.5/dist-packages/perceval/backend.py", line 161, in fetch
    for item in self.fetch_items(category, **kwargs):
  File "/usr/local/lib/python3.5/dist-packages/graal/graal.py", line 183, in fetch_items
    raise e
  File "/usr/local/lib/python3.5/dist-packages/graal/graal.py", line 176, in fetch_items
    commit['analysis'] = self._analyze(commit)
  File "/usr/local/lib/python3.5/dist-packages/graal/backends/core/cocom.py", line 189, in _analyze
    file_info = self.analyzer.analyze(local_path)
  File "/usr/local/lib/python3.5/dist-packages/graal/backends/core/cocom.py", line 242, in analyze
    cloc_analysis = self.cloc.analyze(**kwargs)
  File "/usr/local/lib/python3.5/dist-packages/graal/backends/core/analyzers/cloc.py", line 128, in analyze
    results = self.__analyze_file(message)
  File "/usr/local/lib/python3.5/dist-packages/graal/backends/core/analyzers/cloc.py", line 58, in __analyze_file
    blank_lines = int(info_file[2])
ValueError: invalid literal for int() with base 10: 'Shell'

Tested with graal integration : https://github.com/chaoss/grimoirelab-elk/pull/672

valeriocos commented 5 years ago

Thank you for reporting this @florentk . It seems that you are not using the code in the master branch, but an older release. "/usr/local/lib/python3.5/dist-packages/graal/backends/core/analyzers/cloc.py", line 58 is currently an empty line: https://github.com/chaoss/grimoirelab-graal/blob/master/graal/backends/core/analyzers/cloc.py#L58