jakim/ig-monitoring

View on GitHub

Showing 25 of 53 total issues

Method run has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function run()
    {
        $proxyManager = Yii::createObject(ProxyManager::class);
        $accountBuilder = Yii::createObject([
            'class' => AccountBuilder::class,
Severity: Major
Found in components/services/AccountUpdater.php - About 2 hrs to fix

Function actionUpdateName has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionUpdateName($names)
    {
        $rows = StringHelper::explode($names, ';', true, true);
        foreach ($rows as $row) {
            $username = StringHelper::explode($row);
Severity: Minor
Found in commands/AccountController.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function actionCreateAccount has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionCreateAccount()
    {
        $form = new MonitoringForm();
        $form->setScenario(TrackerType::ACCOUNT);

Severity: Minor
Found in modules/admin/controllers/MonitoringController.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method run has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function run()
    {
        $proxyManager = Yii::createObject(ProxyManager::class);
        $tagBuilder = Yii::createObject([
            'class' => TagBuilder::class,
Severity: Minor
Found in components/services/TagUpdater.php - About 1 hr to fix

Method reserve has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function reserve(bool $ignoreRest = false): Proxy
    {
        $uid = $this->generateUid();
        $condition = [
            'and',
Severity: Minor
Found in components/http/ProxyManager.php - About 1 hr to fix

Method actionTags has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function actionTags()
    {
        $searchModel = new TagSearch();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
        $dataProvider->query->andWhere(['tag.monitoring' => 1]);
Severity: Minor
Found in modules/admin/controllers/MonitoringController.php - About 1 hr to fix

Function actionDictionaries has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionDictionaries()
    {
        $dictionaries = [
            AccountInvalidationType::class,
            TagInvalidationType::class,
Severity: Minor
Found in commands/AdminController.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method actionAccounts has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function actionAccounts()
    {
        $searchModel = new AccountSearch();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
        $dataProvider->query->andWhere(['account.monitoring' => 1]);
Severity: Minor
Found in modules/admin/controllers/MonitoringController.php - About 1 hr to fix

Method initData has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function initData($olderDate, $newerDate = null)
    {
        $olderDate = (new Carbon($olderDate))->startOfDay()->toDateTimeString();
        $newerDate = (new Carbon($newerDate))->endOfDay()->toDateTimeString();

Severity: Minor
Found in components/stats/AccountDaily.php - About 1 hr to fix

Function run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function run()
    {
        $proxyManager = Yii::createObject(ProxyManager::class);
        $accountBuilder = Yii::createObject([
            'class' => AccountBuilder::class,
Severity: Minor
Found in components/services/AccountUpdater.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function fetchAccountData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function fetchAccountData(AccountScraper $scraper): Account
    {
        $idents = array_filter([
            $this->account->username,
        ]);
Severity: Minor
Found in components/services/AccountUpdater.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method init has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function init()
    {
        if (empty($this->statsAttributes)) {
            $this->statsAttributes = [
                'followed_by',

Method run has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function run()
    {
        if ($this->model->monitoring) {
            return AjaxButton::widget([
                'confirm' => true,
Severity: Minor
Found in modules/admin/widgets/OnOffMonitoringButton.php - About 1 hr to fix

Method prepareModels has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function prepareModels()
    {
        $models = [];

        $dbFrom = $this->from->copy();
Severity: Minor
Found in components/stats/providers/AccountDiffDataProvider.php - About 1 hr to fix

Method init has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function init()
    {
        parent::init();
        $this->throwExceptionIfAccountIsNotSet();
        $this->throwExceptionIfFromToAreNotSet();
Severity: Minor
Found in components/stats/providers/AccountTagsDataProvider.php - About 1 hr to fix

Method registerClientScript has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function registerClientScript()
    {
        $options = ArrayHelper::merge([
            'url' => Url::to($this->url),
            'method' => 'post',
Severity: Minor
Found in modules/admin/widgets/AjaxButton.php - About 1 hr to fix

Method run has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function run()
    {
        $config = [
            'id' => $this->id,
            'type' => $this->type,
Severity: Minor
Found in components/visualizations/widgets/ChartWidget.php - About 1 hr to fix

Method actionCreateAccount has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function actionCreateAccount()
    {
        $form = new MonitoringForm();
        $form->setScenario(TrackerType::ACCOUNT);

Severity: Minor
Found in modules/admin/controllers/MonitoringController.php - About 1 hr to fix

Function setStats has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function setStats(Account $account, array $posts, bool $createHistory = true)
    {
        $this->account->touch('stats_updated_at');
        if ($this->account->media === null || $this->statsNeedUpdate($account, $posts)) {
            $postsStats = $this->postsStats($account, $posts);
Severity: Minor
Found in components/builders/AccountBuilder.php - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function actionCreateTag has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionCreateTag()
    {
        $form = new MonitoringForm();
        $form->setScenario(TrackerType::TAG);

Severity: Minor
Found in modules/admin/controllers/MonitoringController.php - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Severity
Category
Status
Source
Language