def test_fetch_nomossa(self): """Test whether commits are properly processed""" cl = CoLic('http://example.com', self.git_path, NOMOS_PATH, self.worktree_path, in_paths=['perceval/backends/core/github.py']) commits = [commit for commit in cl.fetch()] self.assertEqual(len(commits), 1) self.assertFalse(os.path.exists(cl.worktreepath)) for commit in commits: self.assertEqual(commit['backend_name'], 'CoLic') self.assertEqual(commit['category'], CATEGORY_COLIC_NOMOS) self.assertEqual(commit['data']['analysis'][0]['file_path'], 'perceval/backends/core/github.py') self.assertTrue('Author' in commit['data']) self.assertTrue('Commit' in commit['data']) self.assertFalse('files' in commit['data']) self.assertFalse('parents' in commit['data']) self.assertFalse('refs' in commit['data'])
# GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Author: # Sumit Kumar Jangir <*****@*****.**> # imports from graal.backends.core.colic import CoLic, CATEGORY_COLIC_NOMOS, CATEGORY_COLIC_SCANCODE from graal.graal import GraalCommand # setting graal argument parser parser = GraalCommand.setup_cmd_parser() arg = [ 'https://github.com/sumitskj/Prajawalan2019.git', '--git-path', '/tmp/clone' ] args = parser.parse(*arg) # nomos exec_path exec_path = '/home/sumit/fossology/src/nomos/agent/nomossa' # Colic object initialization cc = CoLic(uri=args.uri, git_path=args.git_path, exec_path=exec_path) # fetch all commits for com in cc.fetch(): print(com['data']['CommitDate'])
#! /usr/bin/env python3 from graal.backends.core.cocom import CoCom from graal.backends.core.colic import CoLic SCANCODE = 'scancode' CATEGORY_COLIC_SCANCODE = 'code_license_' + SCANCODE # URL for the git repo to analyze repo_uri = 'https://github.com/chaoss/grimoirelab-toolkit' # directory where to mirror the repo repo_dir = 'users/tanxin/github/graal-cocom' # Cocom object initialization cc = CoCom(uri=repo_uri, git_path=repo_dir) # CoLic object initialization cl = CoLic(uri=repo_uri, git_path=repo_dir, exec_path='/Users/tanxin/Downloads/scancode-toolkit-3.0.2/scancode') # fetch all commits and try Cocom for commit in cc.fetch(): print(commit) ### # fetch all commits and try scancode for commit in cl.fetch(category=CATEGORY_COLIC_SCANCODE): print(commit) ###