Skip to content

Commit

Permalink
fix after small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene-kulak committed Feb 4, 2022
1 parent 918720d commit 8812763
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,8 @@ def _generate_async_jobs(self, params: Mapping) -> Iterator[AsyncJob]:
if ts_start in self._completed_slices:
continue
ts_end = ts_start + pendulum.duration(days=self.time_increment - 1)
total_params = {
**params,
"time_range": {
"since": ts_start.to_date_string(),
"until": ts_end.to_date_string(),
},
}
yield InsightAsyncJob(self._api.api, edge_object=self._api.account, params=total_params, key=ts_start)
interval = pendulum.Period(ts_start, ts_end.date())
yield InsightAsyncJob(api=self._api.api, edge_object=self._api.account, interval=interval, params=params)

def stream_slices(
self, sync_mode: SyncMode, cursor_field: List[str] = None, stream_state: Mapping[str, Any] = None
Expand Down

1 comment on commit 8812763

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SonarQube Report

SonarQube report for Airbyte Connectors Source Facebook Marketing(#9805)

Measures

Name Value Name Value Name Value
Security Rating A Reliability Rating B Duplicated Lines (%) 6.1
Lines to Cover 208 Vulnerabilities 0 Code Smells 31
Quality Gate Status ERROR Lines of Code 1745 Coverage 15.4
Duplicated Blocks 2 Bugs 1 Blocker Issues 0
Critical Issues 2 Major Issues 22 Minor Issues 176

Detected Issues

Rule File Description Message
python:mypy_attr_defined (MINOR) streams/base_insight_streams.py:161 Check that attribute exists Module has no attribute "Period"; maybe "period"? . Code line: interval = pendulum.Period(ts_start, ts_end.date())
python:S1226 (MINOR) streams/async_job.py:125 Function parameters initial values should not be ignored Introduce a new variable or use its initial value before reassigning 'batch'.
python:S3457 (MAJOR) streams/async_job.py:186 String formatting should be used correctly Add argument(s) corresponding to the message's replacement field(s).
python:S3457 (MAJOR) streams/async_job.py:203 String formatting should be used correctly Add argument(s) corresponding to the message's replacement field(s).
python:S3457 (MAJOR) streams/async_job.py:262 String formatting should be used correctly Add argument(s) corresponding to the message's replacement field(s).
python:S3457 (MAJOR) streams/async_job.py:283 String formatting should be used correctly Add argument(s) corresponding to the message's replacement field(s).
python:S3457 (MAJOR) streams/async_job.py:296 String formatting should be used correctly Add argument(s) corresponding to the message's replacement field(s).
python:mypy_attr_defined (MINOR) streams/async_job.py:299 Check that attribute exists pendulum.duration? has no attribute "in_seconds" . Code line: elapsed=self.elapsed_time.in_seconds(),
python:black_need_format (MINOR) streams/async_job.py Please run one of the commands: "black --config ./pyproject.toml <path_to_updated_folder>" or "./gradlew format" 6 code part(s) should be updated.
python:isort_need_format (MINOR) streams/async_job.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:mypy_attr_defined (MINOR) streams/async_job.py Check that attribute exists pendulum.duration? has no attribute "in_seconds" . Code line: ... job=self, status=job_status, elapsed=self.elapsed_time.in_...
flake8:E251 (MAJOR) streams/async_job.py unexpected spaces around keyword / parameter equals unexpected spaces around keyword / parameter equals
flake8:E251 (MAJOR) streams/async_job.py unexpected spaces around keyword / parameter equals unexpected spaces around keyword / parameter equals
python:mypy_no_untyped_def (MINOR) streams/async_job.py:65 Check that every function has an annotation Function is missing a return type annotation . Code line: def attempt_number(self):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:80 Check that every function has an annotation Function is missing a return type annotation . Code line: def update_job(self, batch: Optional[FacebookAdsApiBatch] = None):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:98 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, jobs: List[AsyncJob], **kwargs):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:125 Check that every function has an annotation Function is missing a return type annotation . Code line: def update_job(self, batch: Optional[FacebookAdsApiBatch] = None):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:153 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, edge_object: Union[AdAccount, Campaign], params...
python:mypy_call_arg (MINOR) streams/async_job.py:185 Check number, names and kinds of arguments in calls Unexpected keyword argument "num" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:185 Check number, names and kinds of arguments in calls Unexpected keyword argument "period" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:185 Check number, names and kinds of arguments in calls Unexpected keyword argument "campaign_ids" for "info" of "Logger" . Code line: logger.info(
python:mypy_arg_type (MINOR) streams/async_job.py:193 Check argument types in calls Argument "jobs" to "ParentAsyncJob" has incompatible type "List[InsightAsyncJob]"; expected "List[AsyncJob]" . Code line: ...turn ParentAsyncJob(api=self._api, interval=self._interval, jobs=jobs)
python:mypy_call_arg (MINOR) streams/async_job.py:261 Check number, names and kinds of arguments in calls Unexpected keyword argument "job" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:261 Check number, names and kinds of arguments in calls Unexpected keyword argument "percent" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:261 Check number, names and kinds of arguments in calls Unexpected keyword argument "status" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:282 Check number, names and kinds of arguments in calls Unexpected keyword argument "job" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:282 Check number, names and kinds of arguments in calls Unexpected keyword argument "percent" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:282 Check number, names and kinds of arguments in calls Unexpected keyword argument "status" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:295 Check number, names and kinds of arguments in calls Unexpected keyword argument "job" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:295 Check number, names and kinds of arguments in calls Unexpected keyword argument "status" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:295 Check number, names and kinds of arguments in calls Unexpected keyword argument "elapsed" for "info" of "Logger" . Code line: logger.info(
python:isort_need_format (MINOR) streams/async_job_manager.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:mypy_no_untyped_def (MINOR) streams/base_insight_streams.py:123 Check that every function has an annotation Function is missing a return type annotation . Code line: def state(self, value: Mapping[str, Any]):
python:mypy_no_untyped_def (MINOR) streams/async_job_manager.py:88 Check that every function has an annotation Function is missing a return type annotation . Code line: def _check_jobs_status(self):
python:isort_need_format (MINOR) unit_tests/test_base_insight_streams.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:mypy_no_untyped_def (MINOR) streams/base_insight_streams.py Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def stream_slices(
python:mypy_name_defined (MINOR) streams/base_insight_streams.py:129 Check that name is defined Function is missing a return type annotation [no-untyped-def] def get_updated_state(self, current_stream_state: MutableMapping[s...
python:mypy_name_defined (MINOR) streams/base_insight_streams.py:181 Check that name is defined Incompatible types in assignment (expression has type "Mapping[str, Any]", variable has type "MutableMapping[str, Any]") [assignment] self.state = stream_state
python:mypy_misc (MINOR) source_facebook_marketing/spec.py:18 Miscellaneous other checks Enum() expects a string, tuple, list or dict literal as the second argument . Code line: ValidFields = Enum("ValidEnums", AdsInsights.Field.dict)
python:mypy_misc (MINOR) source_facebook_marketing/spec.py:19 Miscellaneous other checks Enum() expects a string, tuple, list or dict literal as the second argument . Code line: ValidBreakdowns = Enum("ValidBreakdowns", AdsInsights.Breakdowns.__dic...
python:mypy_misc (MINOR) source_facebook_marketing/spec.py:20 Miscellaneous other checks Enum() expects a string, tuple, list or dict literal as the second argument . Code line: ValidActionBreakdowns = Enum("ValidActionBreakdowns", AdsInsights.Acti...
python:isort_need_format (MINOR) streams/base_insight_streams.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 2 code part(s) should be updated.
python:isort_need_format (MINOR) unit_tests/test_async_job.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:isort_need_format (MINOR) unit_tests/test_source.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:isort_need_format (MINOR) integration_tests/test_streams.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:isort_need_format (MINOR) source_facebook_marketing/source.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:mypy_no_untyped_def (MINOR) streams/async_job.py:57 Check that every function has an annotation Function is missing a return type annotation . Code line: def start(self):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:103 Check that every function has an annotation Function is missing a return type annotation . Code line: def start(self):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:195 Check that every function has an annotation Function is missing a return type annotation . Code line: def start(self):
python:isort_need_format (MINOR) unit_tests/test_client.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:mypy_attr_defined (MINOR) streams/init.py Check that attribute exists Module "source_facebook_marketing.streams.streams" does not explicitly export attribute "AdsInsights"; implicit reexport disabled . Code line: from .streams import (
python:mypy_no_untyped_def (MINOR) streams/base_streams.py:40 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, api: "API", include_deleted: bool = False, **kw...
python:mypy_no_untyped_def (MINOR) streams/base_streams.py:50 Check that every function has an annotation Function is missing a type annotation . Code line: def _execute_batch(self, batch):
python:mypy_no_untyped_def (MINOR) streams/base_streams.py:61 Check that every function has an annotation Function is missing a return type annotation . Code line: def success(response: FacebookResponse):
python:mypy_no_untyped_def (MINOR) streams/base_streams.py:64 Check that every function has an annotation Function is missing a return type annotation . Code line: def failure(response: FacebookResponse):
python:S1134 (MAJOR) streams/base_streams.py:65 Track uses of "FIXME" tags Take the required action to fix the issue indicated by this "FIXME" comment.
python:mypy_no_redef (MINOR) streams/base_streams.py:74 Check that each name is defined once Name "api_batch" already defined on line 68 . Code line: api_batch: FacebookAdsApiBatch = self._api.api.new_bat...
python:mypy_assignment (MINOR) streams/base_streams.py:91 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "Iterable[MutableMapping[str, Any]]", variable has type "Generator[Any, None, None]") . Code line: loaded_records_iter = self.execute_in_batch(loaded_records...
python:mypy_no_untyped_def (MINOR) streams/base_streams.py:105 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def request_params(self, **kwargs) -> MutableMapping[str, Any]:
python:mypy_no_untyped_def (MINOR) streams/base_streams.py:143 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, start_date: datetime, end_date: datetime, **kwa...
python:mypy_no_untyped_def (MINOR) streams/base_streams.py:148 Check that every function has an annotation Function is missing a return type annotation . Code line: def get_updated_state(self, current_stream_state: MutableMapping[s...
python:mypy_attr_defined (MINOR) streams/base_streams.py:153 Check that attribute exists Module has no attribute "parse" . Code line: max_cursor = max(pendulum.parse(state_value), pendulum.parse(r...
python:mypy_no_untyped_def (MINOR) streams/base_streams.py:162 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def request_params(self, stream_state: Mapping[str, Any], **kwargs...
python:mypy_override (MINOR) streams/base_streams.py:162 Check that method override is compatible with base class Signature of "request_params" incompatible with supertype "FBMarketingStream" . Code line: def request_params(self, stream_state: Mapping[str, Any], **kwargs...
python:mypy_no_any_return (MINOR) streams/base_streams.py:166 Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "MutableMapping[str, Any]" . Code line: return params
python:mypy_attr_defined (MINOR) streams/base_streams.py:171 Check that attribute exists Module has no attribute "parse" . Code line: ...value = self.start_date if not state_value else pendulum.parse(state...
python:mypy_var_annotated (MINOR) streams/streams.py Require variable annotation if type can't be inferred Need type annotation for "breakdowns" (hint: "breakdowns: List[] = ...") . Code line: breakdowns = []
python:mypy_override (MINOR) streams/base_insight_streams.py:86 Check that method override is compatible with base class Signature of "primary_key" incompatible with supertype "FBMarketingStream" . Code line: def primary_key(self) -> Optional[Union[str, List[str], List[List[...
python:mypy_no_untyped_def (MINOR) streams/async_job_manager.py:49 Check that every function has an annotation Function is missing a return type annotation . Code line: def _start_jobs(self):
python:isort_need_format (MINOR) unit_tests/test_async_job_manager.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:mypy_index (MINOR) streams/streams.py Check indexing operations Unsupported target for indexed assignment ("Mapping[str, Any]") . Code line: record["thumbnail_data_url"] = fetch_thumbnail_data_ur...
python:isort_need_format (MINOR) source_facebook_marketing/api.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:mypy_attr_defined (MINOR) streams/base_insight_streams.py:125 Check that attribute exists Module has no attribute "parse" . Code line: self._cursor_value = pendulum.parse(value[self.cursor_field])....
python:mypy_attr_defined (MINOR) streams/base_insight_streams.py:126 Check that attribute exists Module has no attribute "parse" . Code line: self._completed_slices = set(pendulum.parse(v).date() for v in...
python:mypy_no_any_return (MINOR) streams/base_insight_streams.py:139 Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "Iterator[Any]" . Code line: return date_range.range("days", self.time_increment)
python:mypy_no_untyped_def (MINOR) source_facebook_marketing/api.py:106 Check that every function has an annotation Function is missing a return type annotation . Code line: def _update_insights_throttle_limit(self, response: FacebookRespon...
python:mypy_no_untyped_def (MINOR) streams/async_job.py Check that every function has an annotation Function is missing a type annotation . Code line: def chunks(data, n):
python:mypy_no_untyped_def (MINOR) streams/async_job.py Check that every function has an annotation Function is missing a return type annotation . Code line: def restart_number(self):
python:mypy_no_untyped_def (MINOR) streams/async_job.py Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, api, jobs: List[AsyncJob]):
python:mypy_no_untyped_def (MINOR) streams/async_job.py Check that every function has an annotation Function is missing a return type annotation . Code line: def restart_number(self):
python:mypy_no_untyped_def (MINOR) streams/async_job.py Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, api, edge_object: Any, params: Mapping[str, Any...
python:mypy_attr_defined (MINOR) streams/async_job.py Check that attribute exists Module has no attribute "parse" . Code line: new_start = pendulum.parse(self._params["time_range"]["since"]...
python:mypy_valid_type (MINOR) streams/async_job.py Check that type (annotation) is valid Function is missing a return type annotation [no-untyped-def] def restart_number(self):
flake8:E203 (MAJOR) streams/async_job.py:24 whitespace before ‘:’ whitespace before ':'
python:mypy_no_untyped_def (MINOR) streams/async_job.py:255 Check that every function has an annotation Function is missing a return type annotation . Code line: def update_job(self, batch: Optional[FacebookAdsApiBatch] = None):
python:S3776 (CRITICAL) streams/async_job_manager.py Cognitive Complexity of functions should not be too high Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed.
python:S112 (MAJOR) streams/async_job_manager.py "Exception" and "BaseException" should not be raised Replace this generic exception class with a more specific one.
python:mypy_var_annotated (MINOR) streams/async_job_manager.py:47 Require variable annotation if type can't be inferred Need type annotation for "_running_jobs" (hint: "_running_jobs: List[] = ...") . Code line: self._running_jobs = []
python:mypy_name_defined (MINOR) streams/base_insight_streams.py Check that name is defined Function is missing a type annotation for one or more arguments [no-untyped-def] def stream_slices(self, **kwargs) -> Iterable[Optional[Mapping[str...
python:mypy_no_untyped_def (MINOR) streams/base_insight_streams.py Check that every function has an annotation Function is missing a return type annotation . Code line: def state(self, value: MutableMapping[str, Any]):
python:mypy_misc (MINOR) streams/base_insight_streams.py Miscellaneous other checks "InsightAsyncJob" gets multiple values for keyword argument "edge_object" . Code line: yield InsightAsyncJob(self._api.api, edge_object=self._api...
python:mypy_var_annotated (MINOR) streams/base_insight_streams.py:77 Require variable annotation if type can't be inferred Need type annotation for "_completed_slices" (hint: "_completed_slices: Set[] = ...") . Code line: self._completed_slices = set()
python:mypy_no_untyped_def (MINOR) streams/base_insight_streams.py:141 Check that every function has an annotation Function is missing a return type annotation . Code line: def _advance_cursor(self):
python:S1134 (MAJOR) streams/base_insight_streams.py:206 Track uses of "FIXME" tags Take the required action to fix the issue indicated by this "FIXME" comment.
python:mypy_no_untyped_def (MINOR) streams/base_insight_streams.py:219 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def request_params(self, **kwargs) -> MutableMapping[str, Any]:
python:mypy_override (MINOR) streams/base_insight_streams.py:219 Check that method override is compatible with base class Signature of "request_params" incompatible with supertype "FBMarketingIncrementalStream" . Code line: def request_params(self, **kwargs) -> MutableMapping[str, Any]:
python:S1226 (MINOR) streams/async_job.py Function parameters initial values should not be ignored Introduce a new variable or use its initial value before reassigning 'batch'.
python:mypy_no_untyped_def (MINOR) streams/async_job.py Check that every function has an annotation Function is missing a type annotation . Code line: def update_job(self, batch=None):
python:mypy_no_untyped_def (MINOR) streams/async_job.py Check that every function has an annotation Function is missing a type annotation . Code line: def update_job(self, batch=None):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:61 Check that every function has an annotation Function is missing a return type annotation . Code line: def restart(self):
python:mypy_attr_defined (MINOR) streams/base_insight_streams.py:161 Check that attribute exists Module has no attribute "Period"; maybe "period"? . Code line: interval = pendulum.Period(ts_start, ts_end.date())
python:S1226 (MINOR) streams/async_job.py:125 Function parameters initial values should not be ignored Introduce a new variable or use its initial value before reassigning 'batch'.
python:S3457 (MAJOR) streams/async_job.py:186 String formatting should be used correctly Add argument(s) corresponding to the message's replacement field(s).
python:S3457 (MAJOR) streams/async_job.py:203 String formatting should be used correctly Add argument(s) corresponding to the message's replacement field(s).
python:S3457 (MAJOR) streams/async_job.py:262 String formatting should be used correctly Add argument(s) corresponding to the message's replacement field(s).
python:S3457 (MAJOR) streams/async_job.py:283 String formatting should be used correctly Add argument(s) corresponding to the message's replacement field(s).
python:S3457 (MAJOR) streams/async_job.py:296 String formatting should be used correctly Add argument(s) corresponding to the message's replacement field(s).
python:mypy_attr_defined (MINOR) streams/async_job.py:299 Check that attribute exists pendulum.duration? has no attribute "in_seconds" . Code line: elapsed=self.elapsed_time.in_seconds(),
python:black_need_format (MINOR) streams/async_job.py Please run one of the commands: "black --config ./pyproject.toml <path_to_updated_folder>" or "./gradlew format" 6 code part(s) should be updated.
python:isort_need_format (MINOR) streams/async_job.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:mypy_attr_defined (MINOR) streams/async_job.py Check that attribute exists pendulum.duration? has no attribute "in_seconds" . Code line: ... job=self, status=job_status, elapsed=self.elapsed_time.in_...
flake8:E251 (MAJOR) streams/async_job.py unexpected spaces around keyword / parameter equals unexpected spaces around keyword / parameter equals
flake8:E251 (MAJOR) streams/async_job.py unexpected spaces around keyword / parameter equals unexpected spaces around keyword / parameter equals
python:mypy_no_untyped_def (MINOR) streams/async_job.py:65 Check that every function has an annotation Function is missing a return type annotation . Code line: def attempt_number(self):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:80 Check that every function has an annotation Function is missing a return type annotation . Code line: def update_job(self, batch: Optional[FacebookAdsApiBatch] = None):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:98 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, jobs: List[AsyncJob], **kwargs):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:125 Check that every function has an annotation Function is missing a return type annotation . Code line: def update_job(self, batch: Optional[FacebookAdsApiBatch] = None):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:153 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, edge_object: Union[AdAccount, Campaign], params...
python:mypy_call_arg (MINOR) streams/async_job.py:185 Check number, names and kinds of arguments in calls Unexpected keyword argument "num" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:185 Check number, names and kinds of arguments in calls Unexpected keyword argument "period" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:185 Check number, names and kinds of arguments in calls Unexpected keyword argument "campaign_ids" for "info" of "Logger" . Code line: logger.info(
python:mypy_arg_type (MINOR) streams/async_job.py:193 Check argument types in calls Argument "jobs" to "ParentAsyncJob" has incompatible type "List[InsightAsyncJob]"; expected "List[AsyncJob]" . Code line: ...turn ParentAsyncJob(api=self._api, interval=self._interval, jobs=jobs)
python:mypy_call_arg (MINOR) streams/async_job.py:261 Check number, names and kinds of arguments in calls Unexpected keyword argument "job" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:261 Check number, names and kinds of arguments in calls Unexpected keyword argument "percent" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:261 Check number, names and kinds of arguments in calls Unexpected keyword argument "status" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:282 Check number, names and kinds of arguments in calls Unexpected keyword argument "job" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:282 Check number, names and kinds of arguments in calls Unexpected keyword argument "percent" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:282 Check number, names and kinds of arguments in calls Unexpected keyword argument "status" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:295 Check number, names and kinds of arguments in calls Unexpected keyword argument "job" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:295 Check number, names and kinds of arguments in calls Unexpected keyword argument "status" for "info" of "Logger" . Code line: logger.info(
python:mypy_call_arg (MINOR) streams/async_job.py:295 Check number, names and kinds of arguments in calls Unexpected keyword argument "elapsed" for "info" of "Logger" . Code line: logger.info(
python:isort_need_format (MINOR) streams/async_job_manager.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:mypy_no_untyped_def (MINOR) streams/base_insight_streams.py:123 Check that every function has an annotation Function is missing a return type annotation . Code line: def state(self, value: Mapping[str, Any]):
python:mypy_no_untyped_def (MINOR) streams/async_job_manager.py:88 Check that every function has an annotation Function is missing a return type annotation . Code line: def _check_jobs_status(self):
python:isort_need_format (MINOR) unit_tests/test_base_insight_streams.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:mypy_no_untyped_def (MINOR) streams/base_insight_streams.py Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def stream_slices(
python:mypy_name_defined (MINOR) streams/base_insight_streams.py:129 Check that name is defined Function is missing a return type annotation [no-untyped-def] def get_updated_state(self, current_stream_state: MutableMapping[s...
python:mypy_name_defined (MINOR) streams/base_insight_streams.py:181 Check that name is defined Incompatible types in assignment (expression has type "Mapping[str, Any]", variable has type "MutableMapping[str, Any]") [assignment] self.state = stream_state
python:mypy_misc (MINOR) source_facebook_marketing/spec.py:18 Miscellaneous other checks Enum() expects a string, tuple, list or dict literal as the second argument . Code line: ValidFields = Enum("ValidEnums", AdsInsights.Field.dict)
python:mypy_misc (MINOR) source_facebook_marketing/spec.py:19 Miscellaneous other checks Enum() expects a string, tuple, list or dict literal as the second argument . Code line: ValidBreakdowns = Enum("ValidBreakdowns", AdsInsights.Breakdowns.__dic...
python:mypy_misc (MINOR) source_facebook_marketing/spec.py:20 Miscellaneous other checks Enum() expects a string, tuple, list or dict literal as the second argument . Code line: ValidActionBreakdowns = Enum("ValidActionBreakdowns", AdsInsights.Acti...
python:isort_need_format (MINOR) streams/base_insight_streams.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 2 code part(s) should be updated.
python:isort_need_format (MINOR) unit_tests/test_async_job.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:isort_need_format (MINOR) unit_tests/test_source.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:isort_need_format (MINOR) integration_tests/test_streams.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:isort_need_format (MINOR) source_facebook_marketing/source.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:mypy_no_untyped_def (MINOR) streams/async_job.py:57 Check that every function has an annotation Function is missing a return type annotation . Code line: def start(self):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:103 Check that every function has an annotation Function is missing a return type annotation . Code line: def start(self):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:195 Check that every function has an annotation Function is missing a return type annotation . Code line: def start(self):
python:isort_need_format (MINOR) unit_tests/test_client.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:mypy_attr_defined (MINOR) streams/init.py Check that attribute exists Module "source_facebook_marketing.streams.streams" does not explicitly export attribute "AdsInsights"; implicit reexport disabled . Code line: from .streams import (
python:mypy_no_untyped_def (MINOR) streams/base_streams.py:40 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, api: "API", include_deleted: bool = False, **kw...
python:mypy_no_untyped_def (MINOR) streams/base_streams.py:50 Check that every function has an annotation Function is missing a type annotation . Code line: def _execute_batch(self, batch):
python:mypy_no_untyped_def (MINOR) streams/base_streams.py:61 Check that every function has an annotation Function is missing a return type annotation . Code line: def success(response: FacebookResponse):
python:mypy_no_untyped_def (MINOR) streams/base_streams.py:64 Check that every function has an annotation Function is missing a return type annotation . Code line: def failure(response: FacebookResponse):
python:S1134 (MAJOR) streams/base_streams.py:65 Track uses of "FIXME" tags Take the required action to fix the issue indicated by this "FIXME" comment.
python:mypy_no_redef (MINOR) streams/base_streams.py:74 Check that each name is defined once Name "api_batch" already defined on line 68 . Code line: api_batch: FacebookAdsApiBatch = self._api.api.new_bat...
python:mypy_assignment (MINOR) streams/base_streams.py:91 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "Iterable[MutableMapping[str, Any]]", variable has type "Generator[Any, None, None]") . Code line: loaded_records_iter = self.execute_in_batch(loaded_records...
python:mypy_no_untyped_def (MINOR) streams/base_streams.py:105 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def request_params(self, **kwargs) -> MutableMapping[str, Any]:
python:mypy_no_untyped_def (MINOR) streams/base_streams.py:143 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, start_date: datetime, end_date: datetime, **kwa...
python:mypy_no_untyped_def (MINOR) streams/base_streams.py:148 Check that every function has an annotation Function is missing a return type annotation . Code line: def get_updated_state(self, current_stream_state: MutableMapping[s...
python:mypy_attr_defined (MINOR) streams/base_streams.py:153 Check that attribute exists Module has no attribute "parse" . Code line: max_cursor = max(pendulum.parse(state_value), pendulum.parse(r...
python:mypy_no_untyped_def (MINOR) streams/base_streams.py:162 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def request_params(self, stream_state: Mapping[str, Any], **kwargs...
python:mypy_override (MINOR) streams/base_streams.py:162 Check that method override is compatible with base class Signature of "request_params" incompatible with supertype "FBMarketingStream" . Code line: def request_params(self, stream_state: Mapping[str, Any], **kwargs...
python:mypy_no_any_return (MINOR) streams/base_streams.py:166 Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "MutableMapping[str, Any]" . Code line: return params
python:mypy_attr_defined (MINOR) streams/base_streams.py:171 Check that attribute exists Module has no attribute "parse" . Code line: ...value = self.start_date if not state_value else pendulum.parse(state...
python:mypy_var_annotated (MINOR) streams/streams.py Require variable annotation if type can't be inferred Need type annotation for "breakdowns" (hint: "breakdowns: List[] = ...") . Code line: breakdowns = []
python:mypy_override (MINOR) streams/base_insight_streams.py:86 Check that method override is compatible with base class Signature of "primary_key" incompatible with supertype "FBMarketingStream" . Code line: def primary_key(self) -> Optional[Union[str, List[str], List[List[...
python:mypy_no_untyped_def (MINOR) streams/async_job_manager.py:49 Check that every function has an annotation Function is missing a return type annotation . Code line: def _start_jobs(self):
python:isort_need_format (MINOR) unit_tests/test_async_job_manager.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:mypy_index (MINOR) streams/streams.py Check indexing operations Unsupported target for indexed assignment ("Mapping[str, Any]") . Code line: record["thumbnail_data_url"] = fetch_thumbnail_data_ur...
python:isort_need_format (MINOR) source_facebook_marketing/api.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:mypy_attr_defined (MINOR) streams/base_insight_streams.py:125 Check that attribute exists Module has no attribute "parse" . Code line: self._cursor_value = pendulum.parse(value[self.cursor_field])....
python:mypy_attr_defined (MINOR) streams/base_insight_streams.py:126 Check that attribute exists Module has no attribute "parse" . Code line: self._completed_slices = set(pendulum.parse(v).date() for v in...
python:mypy_no_any_return (MINOR) streams/base_insight_streams.py:139 Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "Iterator[Any]" . Code line: return date_range.range("days", self.time_increment)
python:mypy_no_untyped_def (MINOR) source_facebook_marketing/api.py:106 Check that every function has an annotation Function is missing a return type annotation . Code line: def _update_insights_throttle_limit(self, response: FacebookRespon...
python:mypy_no_untyped_def (MINOR) streams/async_job.py Check that every function has an annotation Function is missing a type annotation . Code line: def chunks(data, n):
python:mypy_no_untyped_def (MINOR) streams/async_job.py Check that every function has an annotation Function is missing a return type annotation . Code line: def restart_number(self):
python:mypy_no_untyped_def (MINOR) streams/async_job.py Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, api, jobs: List[AsyncJob]):
python:mypy_no_untyped_def (MINOR) streams/async_job.py Check that every function has an annotation Function is missing a return type annotation . Code line: def restart_number(self):
python:mypy_no_untyped_def (MINOR) streams/async_job.py Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, api, edge_object: Any, params: Mapping[str, Any...
python:mypy_attr_defined (MINOR) streams/async_job.py Check that attribute exists Module has no attribute "parse" . Code line: new_start = pendulum.parse(self._params["time_range"]["since"]...
python:mypy_valid_type (MINOR) streams/async_job.py Check that type (annotation) is valid Function is missing a return type annotation [no-untyped-def] def restart_number(self):
flake8:E203 (MAJOR) streams/async_job.py:24 whitespace before ‘:’ whitespace before ':'
python:mypy_no_untyped_def (MINOR) streams/async_job.py:255 Check that every function has an annotation Function is missing a return type annotation . Code line: def update_job(self, batch: Optional[FacebookAdsApiBatch] = None):
python:S3776 (CRITICAL) streams/async_job_manager.py Cognitive Complexity of functions should not be too high Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed.
python:S112 (MAJOR) streams/async_job_manager.py "Exception" and "BaseException" should not be raised Replace this generic exception class with a more specific one.
python:mypy_var_annotated (MINOR) streams/async_job_manager.py:47 Require variable annotation if type can't be inferred Need type annotation for "_running_jobs" (hint: "_running_jobs: List[] = ...") . Code line: self._running_jobs = []
python:mypy_name_defined (MINOR) streams/base_insight_streams.py Check that name is defined Function is missing a type annotation for one or more arguments [no-untyped-def] def stream_slices(self, **kwargs) -> Iterable[Optional[Mapping[str...
python:mypy_no_untyped_def (MINOR) streams/base_insight_streams.py Check that every function has an annotation Function is missing a return type annotation . Code line: def state(self, value: MutableMapping[str, Any]):
python:mypy_misc (MINOR) streams/base_insight_streams.py Miscellaneous other checks "InsightAsyncJob" gets multiple values for keyword argument "edge_object" . Code line: yield InsightAsyncJob(self._api.api, edge_object=self._api...
python:mypy_var_annotated (MINOR) streams/base_insight_streams.py:77 Require variable annotation if type can't be inferred Need type annotation for "_completed_slices" (hint: "_completed_slices: Set[] = ...") . Code line: self._completed_slices = set()
python:mypy_no_untyped_def (MINOR) streams/base_insight_streams.py:141 Check that every function has an annotation Function is missing a return type annotation . Code line: def _advance_cursor(self):
python:S1134 (MAJOR) streams/base_insight_streams.py:206 Track uses of "FIXME" tags Take the required action to fix the issue indicated by this "FIXME" comment.
python:mypy_no_untyped_def (MINOR) streams/base_insight_streams.py:219 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def request_params(self, **kwargs) -> MutableMapping[str, Any]:
python:mypy_override (MINOR) streams/base_insight_streams.py:219 Check that method override is compatible with base class Signature of "request_params" incompatible with supertype "FBMarketingIncrementalStream" . Code line: def request_params(self, **kwargs) -> MutableMapping[str, Any]:
python:S1226 (MINOR) streams/async_job.py Function parameters initial values should not be ignored Introduce a new variable or use its initial value before reassigning 'batch'.
python:mypy_no_untyped_def (MINOR) streams/async_job.py Check that every function has an annotation Function is missing a type annotation . Code line: def update_job(self, batch=None):
python:mypy_no_untyped_def (MINOR) streams/async_job.py Check that every function has an annotation Function is missing a type annotation . Code line: def update_job(self, batch=None):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:61 Check that every function has an annotation Function is missing a return type annotation . Code line: def restart(self):

Coverage (15.4%)

File Coverage File Coverage
integration_tests/acceptance.py 0.0 integration_tests/conftest.py 0.0
integration_tests/test_streams.py 0.0 main.py 0.0
setup.py 0.0 source_facebook_marketing/init.py 100.0
source_facebook_marketing/api.py 76.7 source_facebook_marketing/source.py 74.3
source_facebook_marketing/spec.py 100.0 source_facebook_marketing/streams/init.py 100.0
source_facebook_marketing/streams/async_job.py 44.2 source_facebook_marketing/streams/async_job_manager.py 48.3
source_facebook_marketing/streams/base_insight_streams.py 86.7 source_facebook_marketing/streams/base_streams.py 79.2
source_facebook_marketing/streams/common.py 97.1 source_facebook_marketing/streams/streams.py 80.0
unit_tests/conftest.py 0.0 unit_tests/test_async_job.py 0.0
unit_tests/test_async_job_manager.py 0.0 unit_tests/test_base_insight_streams.py 0.0
unit_tests/test_client.py 0.0 unit_tests/test_deep_merge.py 0.0
unit_tests/test_source.py 0.0

Please sign in to comment.