mirror of
https://github.com/hohn/sarif-cli.git
synced 2025-12-16 17:23:03 +01:00
Some cleanup based on pyflakes output
This commit is contained in:
committed by
=Michael Hohn
parent
bdf85eafc8
commit
db00f17137
@@ -38,7 +38,7 @@
|
|||||||
python3 -m pip install -r requirements.txt
|
python3 -m pip install -r requirements.txt
|
||||||
# Or separately:
|
# Or separately:
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install ipython pyyaml pandas jupyter
|
pip install ipython pyyaml pandas jupyter pyflakes
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
"Install" for local development:
|
"Install" for local development:
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import json
|
import json
|
||||||
import sarif_cli.traverse as S
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# TODO command-line: sarif-digest [<file>]
|
# TODO command-line: sarif-digest [<file>]
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ from sarif_cli import typegraph
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
import sarif_cli.table_joins as tj
|
import sarif_cli.table_joins as tj
|
||||||
import sys
|
import sys
|
||||||
from collections import UserDict
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import pathlib
|
|||||||
from sarif_cli import signature, signature_single
|
from sarif_cli import signature, signature_single
|
||||||
from sarif_cli import typegraph
|
from sarif_cli import typegraph
|
||||||
import sys
|
import sys
|
||||||
from collections import defaultdict
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
import sarif_cli.traverse as S
|
|
||||||
import sys
|
import sys
|
||||||
import collections
|
import collections
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import argparse
|
|||||||
import json
|
import json
|
||||||
import sarif_cli.traverse as S
|
import sarif_cli.traverse as S
|
||||||
import sys
|
import sys
|
||||||
import collections
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='list source files referenced by sarif file')
|
parser = argparse.ArgumentParser(description='list source files referenced by sarif file')
|
||||||
parser.add_argument('file', metavar='sarif-file', type=str,
|
parser.add_argument('file', metavar='sarif-file', type=str,
|
||||||
|
|||||||
@@ -2,9 +2,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
import sarif_cli.traverse as S
|
import sarif_cli.traverse as S
|
||||||
import re
|
|
||||||
import sys
|
import sys
|
||||||
import collections
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='summary of results')
|
parser = argparse.ArgumentParser(description='summary of results')
|
||||||
parser.add_argument('file', metavar='sarif-file', type=str, help='input file, - for stdin')
|
parser.add_argument('file', metavar='sarif-file', type=str, help='input file, - for stdin')
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ This file also contains some type graph reference values; these may be moved out
|
|||||||
separate files at some point.
|
separate files at some point.
|
||||||
"""
|
"""
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import *
|
from typing import Any, Dict, List, Tuple, Union
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -230,7 +230,7 @@ def _destructure_list(typegraph, node: str, tree: List):
|
|||||||
id(value)))
|
id(value)))
|
||||||
# Next `value` on success
|
# Next `value` on success
|
||||||
break
|
break
|
||||||
except MissingFieldException as e:
|
except MissingFieldException:
|
||||||
# Re-raise if last available signature failed, otherwise try
|
# Re-raise if last available signature failed, otherwise try
|
||||||
# next `signature`
|
# next `signature`
|
||||||
if (sigindex, sigtype) == signature[-1]:
|
if (sigindex, sigtype) == signature[-1]:
|
||||||
@@ -265,14 +265,12 @@ def tagged_array_columns(typegraph, array_id):
|
|||||||
t8754_array_id t8754_value_index t8754_type_at_index t8754_id_or_value_at_index
|
t8754_array_id t8754_value_index t8754_type_at_index t8754_id_or_value_at_index
|
||||||
"""
|
"""
|
||||||
array_id = str(array_id)
|
array_id = str(array_id)
|
||||||
typedef = 'Array' + array_id
|
|
||||||
colheader = ('array_id', 'value_index', 'type_at_index', 'id_or_value_at_index')
|
colheader = ('array_id', 'value_index', 'type_at_index', 'id_or_value_at_index')
|
||||||
return { header:"t{:s}_{:s}".format(array_id, header) for header in colheader}
|
return { header:"t{:s}_{:s}".format(array_id, header) for header in colheader}
|
||||||
|
|
||||||
|
|
||||||
def tagged_struct_columns(typegraph, struct_id):
|
def tagged_struct_columns(typegraph, struct_id):
|
||||||
""" Return a dict mapping the struct column names to versions tagged with the id.
|
""" Return a dict mapping the struct column names to versions tagged with the id.
|
||||||
XX:
|
|
||||||
"""
|
"""
|
||||||
struct_id = str(struct_id)
|
struct_id = str(struct_id)
|
||||||
typedef = 'Struct' + struct_id
|
typedef = 'Struct' + struct_id
|
||||||
|
|||||||
Reference in New Issue
Block a user