Skip to content

Commit

Permalink
Improve error message for unused vars (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
za-creature committed Sep 14, 2016
1 parent 4afcd6f commit 0da7452
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Scope.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,19 @@ module.exports = class Scope
type is "Argument" and @options["unused_arguments"]
then do ->
if reads.length or innerReads.length
return # variable was used at least once
return # variable was read at least once

for {locationData}, index in writes.concat(innerWrites)
# issue a variable-is-assigned-but-never-used warning every
# issue a variable-is-assigned-but-never-read warning every
# time it is accessed (here and in all child scopes)
errors.push({
# context: location
lineNumber: locationData.first_line + 1
message: if index
"#{type} \"#{name}\" is never used (first
defined on line #{defined.first_line + 1})"
"#{type} \"#{name}\" is assigned to but never read
(first defined on line #{defined.first_line + 1})"
else
"#{type} \"#{name}\" is never used"
"#{type} \"#{name}\" is assigned to but never read"
})

if @options["overwrite"] then do =>
Expand Down

0 comments on commit 0da7452

Please sign in to comment.