Skip to content

Commit fb5de47

Browse files
committed
Improvements
- Remove the auto flag, crytic-compile will directly use the auto feature if its on .sol file + the working director is a known platform - Remove abstract from config to reduce code footprint
1 parent 2b2a5a5 commit fb5de47

File tree

15 files changed

+1
-154
lines changed

15 files changed

+1
-154
lines changed

crytic_compile/crytic_compile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def __init__(self, target: Union[str, AbstractPlatform], **kwargs: str) -> None:
127127
# If the platform is Solc it means we are trying to compile a single
128128
# we try to see if we are in a known compilation framework to retrieve
129129
# information like remappings and solc version
130-
if kwargs.get("auto_compile", False) and isinstance(platform, Solc):
130+
if isinstance(platform, Solc):
131131
# Try to get the platform of the current working directory
132132
platform_wd = next(
133133
(

crytic_compile/cryticparser/cryticparser.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,6 @@ def init(parser: ArgumentParser) -> None:
6565
default=DEFAULTS_FLAG_IN_CONFIG["skip_clean"],
6666
)
6767

68-
group_compile.add_argument(
69-
"--auto-compile",
70-
help="Try to get the solc options automatically when compiling a single file",
71-
action="store_true",
72-
dest="auto_compile",
73-
default=DEFAULTS_FLAG_IN_CONFIG["auto_compile"],
74-
)
75-
7668
_init_solc(parser)
7769
_init_truffle(parser)
7870
_init_embark(parser)

crytic_compile/platform/abstract_platform.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ def is_dependency(self, path: str) -> bool:
177177
return False
178178

179179
@staticmethod
180-
@abc.abstractmethod
181180
def config(working_dir: str) -> Optional[PlatformConfig]:
182181
"""Return configuration data that should be passed to solc, such as version, remappings ecc.
183182

crytic_compile/platform/archive.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,6 @@ def is_supported(target: str, **kwargs: str) -> bool:
118118
return False
119119
return Path(target).parts[-1].endswith("_export_archive.json")
120120

121-
@staticmethod
122-
def config(working_dir: str) -> Optional[PlatformConfig]:
123-
"""Return configuration data that should be passed to solc, such as remappings.
124-
125-
Args:
126-
working_dir (str): path to the working directory
127-
128-
Returns:
129-
Optional[PlatformConfig]: Platform configuration data such as optimization, remappings...
130-
"""
131-
return None
132-
133121
def is_dependency(self, _path: str) -> bool:
134122
"""Check if the _path is a dependency. Always false
135123

crytic_compile/platform/brownie.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,6 @@ def is_supported(target: str, **kwargs: str) -> bool:
114114
or os.path.isfile(os.path.join(target, "brownie-config.yml"))
115115
)
116116

117-
@staticmethod
118-
def config(working_dir: str) -> Optional[PlatformConfig]:
119-
"""Return configuration data that should be passed to solc, such as remappings.
120-
121-
Args:
122-
working_dir (str): path to the working directory
123-
124-
Returns:
125-
Optional[PlatformConfig]: Platform configuration data such as optimization, remappings...
126-
"""
127-
return None
128-
129117
def is_dependency(self, _path: str) -> bool:
130118
"""Check if the path is a dependency (not supported for brownie)
131119

crytic_compile/platform/buidler.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -193,18 +193,6 @@ def is_supported(target: str, **kwargs: str) -> bool:
193193
is_typescript = os.path.isfile(os.path.join(target, "buidler.config.ts"))
194194
return is_javascript or is_typescript
195195

196-
@staticmethod
197-
def config(working_dir: str) -> Optional[PlatformConfig]:
198-
"""Return configuration data that should be passed to solc, such as remappings.
199-
200-
Args:
201-
working_dir (str): path to the working directory
202-
203-
Returns:
204-
Optional[PlatformConfig]: Platform configuration data such as optimization, remappings...
205-
"""
206-
return None
207-
208196
def is_dependency(self, path: str) -> bool:
209197
"""Check if the path is a dependency
210198

crytic_compile/platform/dapp.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -157,18 +157,6 @@ def is_supported(target: str, **kwargs: str) -> bool:
157157
return "dapp " in txt
158158
return False
159159

160-
@staticmethod
161-
def config(working_dir: str) -> Optional[PlatformConfig]:
162-
"""Return configuration data that should be passed to solc, such as remappings.
163-
164-
Args:
165-
working_dir (str): path to the working directory
166-
167-
Returns:
168-
Optional[PlatformConfig]: Platform configuration data such as optimization, remappings...
169-
"""
170-
return None
171-
172160
def is_dependency(self, path: str) -> bool:
173161
"""Check if the path is a dependency (not supported for brownie)
174162

crytic_compile/platform/embark.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,18 +200,6 @@ def is_supported(target: str, **kwargs: str) -> bool:
200200
return False
201201
return os.path.isfile(os.path.join(target, "embark.json"))
202202

203-
@staticmethod
204-
def config(working_dir: str) -> Optional[PlatformConfig]:
205-
"""Return configuration data that should be passed to solc, such as remappings.
206-
207-
Args:
208-
working_dir (str): path to the working directory
209-
210-
Returns:
211-
Optional[PlatformConfig]: Platform configuration data such as optimization, remappings...
212-
"""
213-
return None
214-
215203
def is_dependency(self, path: str) -> bool:
216204
"""Check if the path is a dependency
217205

crytic_compile/platform/etherlime.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,6 @@ def is_supported(target: str, **kwargs: str) -> bool:
192192
)
193193
return False
194194

195-
@staticmethod
196-
def config(working_dir: str) -> Optional[PlatformConfig]:
197-
"""Return configuration data that should be passed to solc, such as remappings.
198-
199-
Args:
200-
working_dir (str): path to the working directory
201-
202-
Returns:
203-
Optional[PlatformConfig]: Platform configuration data such as optimization, remappings...
204-
"""
205-
return None
206-
207195
def is_dependency(self, path: str) -> bool:
208196
"""Check if the path is a dependency
209197

crytic_compile/platform/etherscan.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -430,18 +430,6 @@ def is_supported(target: str, **kwargs: str) -> bool:
430430
target = target[target.find(":") + 1 :]
431431
return bool(re.match(r"^\s*0x[a-zA-Z0-9]{40}\s*$", target))
432432

433-
@staticmethod
434-
def config(working_dir: str) -> Optional[PlatformConfig]:
435-
"""Return configuration data that should be passed to solc, such as remappings.
436-
437-
Args:
438-
working_dir (str): path to the working directory
439-
440-
Returns:
441-
Optional[PlatformConfig]: Platform configuration data such as optimization, remappings...
442-
"""
443-
return None
444-
445433
def is_dependency(self, _path: str) -> bool:
446434
"""Check if the path is a dependency
447435

0 commit comments

Comments
 (0)