atom / deprecation-cop

Shows a list of deprecated calls
MIT License
12 stars 19 forks source link

Uncaught TypeError: Error processing argument -1. #66

Closed jerone closed 8 years ago

jerone commented 8 years ago

[Enter steps to reproduce below:]

  1. Clicked the "Report Issue" button on a deprecation call item.

Atom Version: 1.5.0-beta2 System: Microsoft Windows 7 Home Premium Thrown From: deprecation-cop package, v0.54.0

Stack Trace

Uncaught TypeError: Error processing argument -1.

At C:\Users\jerone\AppData\Local\atom\app-1.5.0-beta2\resources\app.asar\node_modules\deprecation-cop\lib\deprecation-cop-view.js:189

TypeError: Error processing argument -1.
    at TypeError (native)
    at openExternally (C:\Users\jerone\AppData\Local\atom\app-1.5.0-beta2\resources\app.asar\node_modules\deprecation-cop\lib\deprecation-cop-view.js:189:33)
    at Object.$.ajax.success (C:\Users\jerone\AppData\Local\atom\app-1.5.0-beta2\resources\app.asar\node_modules\deprecation-cop\lib\deprecation-cop-view.js:203:22)
    at fire (C:\Users\jerone\AppData\Local\atom\app-1.5.0-beta2\resources\app.asar\node_modules\jquery\dist\jquery.js:3099:30)
    at Object.self.fireWith [as resolveWith] (C:\Users\jerone\AppData\Local\atom\app-1.5.0-beta2\resources\app.asar\node_modules\jquery\dist\jquery.js:3211:7)
    at done (C:\Users\jerone\AppData\Local\atom\app-1.5.0-beta2\resources\app.asar\node_modules\jquery\dist\jquery.js:8264:14)
    at XMLHttpRequest.<anonymous> (C:\Users\jerone\AppData\Local\atom\app-1.5.0-beta2\resources\app.asar\node_modules\jquery\dist\jquery.js:8605:9)

Commands

     -0:29.7.0 deprecation-cop:view (atom-workspace.workspace.scrollbars-visible-always.use-animations.theme-atom-material-syntax.theme-atom-material-ui.panel-contrast.tinted-tab-bar.blend-tree-view.compact-tree-view.compact-tab-bar)

Config

{
  "core": {
    "disabledPackages": [
      "atom-jade",
      "json-schema"
    ],
    "themes": [
      "atom-material-ui",
      "atom-material-syntax"
    ]
  }
}

Installed Packages

# User
atom-json-editor, v0.4.1
atom-less, v0.1.10
atom-material-syntax, v0.3.2
atom-material-ui, v0.8.1
atom-minify, v0.7.1
bottom-dock, v0.3.7
coffee-refactor, v0.7.0
color-picker, v2.1.1
editorconfig, v1.2.4
file-icons, v1.6.14
flex-tool-bar, v0.7.3
foldername-tabs, v0.1.10
gutter-shadow, v0.6.0
imdone-atom, v1.3.25
indentation-indicator, v0.6.0
jade-autocompile, v0.8.3
language-actionscript3, v0.3.0
language-jade, v0.6.3
less-postcss-autocompile, v1.2.3
less-than-slash, v0.12.3
linter, v1.11.3
linter-coffeelint, v1.1.2
linter-csslint, v1.2.0
linter-htmlhint, v1.0.2
linter-jade, v0.3.2
linter-jshint, v1.3.0
linter-just-say-no, v0.6.1
linter-less, v2.3.3
linter-manager, v0.2.8
linter-markdown, v1.3.0
linter-sass-lint, v1.0.3
linter-scspell, v2.0.1
markdown-scroll-sync, v2.0.3
menu-manager, v0.4.4
minimap, v4.19.0
minimap-bookmarks, v0.2.0
minimap-find-and-replace, v4.4.0
minimap-git-diff, v4.1.8
minimap-highlight-selected, v4.3.1
minimap-linter, v1.1.1
minimap-pigments, v0.1.7
minimap-selection, v4.3.1
new-tab, v0.5.0
open-recent, v5.0.0
pigments, v0.23.0
pinned-tabs, v0.1.12
project-view, v0.5.0
refactor, v0.6.0
sass-autocompile, v0.12.2
soft-wrap-indicator, v0.7.0
sync-settings, v0.6.0
tool-bar, v0.2.0

# Dev
atom-material-ui, v1.0.5
jerone commented 8 years ago

This issue still happens when I press the "Report Issue" button on a deprecation in the deprecation's cop pane.

The following message appeared in the console:

Failed to load resource: the server responded with a status of 422 (Unprocessable Entity)
https://api.github.com/search/issues?q=Object.TextEditor%20is%20deprecated.%20repo:git+mark-hahn/markdown-scroll-sync&sort=created

When opening above url it will print the following message:

{
    "message": "Validation Failed",
    "errors": [
        {
            "message": "The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.",
            "resource": "Search",
            "field": "q",
            "code": "invalid"
        }
    ],
    "documentation_url": "https://developer.github.com/v3/search/"
}

Hope that helps a little bit.

oychang commented 8 years ago

I had the same issue as @jerone. The issue seems to be from the regular expression on deprecation-cop-view.coffee:84:

repo = repoUrl.replace /http(s)?:\/\/(\d+\.)?github.com\//gi, ''

works on some packages, but not for others with a ^git+ prefix (cherrypicked examples from atom.packages.getActivePackages()[*].metadata.repository...

{"type": "git", "url": "git+https://github.com/ben/autoflow-diffable.git"}
{"type": "git", "url": "https://github.com/atom/atom-dark-syntax.git"}

which results in malformed URLs that are visible in the search api request above.

jerone commented 8 years ago

with a ^git+ prefix

I can confirm this. When removing git+ from the url I get a valid response back from the server:

-https://api.github.com/search/issues?q=Object.TextEditor%20is%20deprecated.%20repo:git+mark-hahn/markdown-scroll-sync&sort=created
+https://api.github.com/search/issues?q=Object.TextEditor%20is%20deprecated.%20repo:mark-hahn/markdown-scroll-sync&sort=created

Something similar was done for the settings-view package: https://github.com/atom/settings-view/pull/512

nathansobo commented 8 years ago

Thanks for the report. This is now fixed on master via a fix to package repository URL normalization in the package manager.