|
174 | 174 | expect(issues).to be_empty
|
175 | 175 | end
|
176 | 176 |
|
| 177 | + it "ignores imports and reports proper line number boundaries" do |
| 178 | + create_source_file("foo.js", <<~EOJS) |
| 179 | + 'use strict'; |
| 180 | +
|
| 181 | + import React from 'react'; |
| 182 | +
|
| 183 | + import Translator from '../../../i18n/translator-tag.jsx'; |
| 184 | + import { gettingSeniorID } from '../../../helpers/data/senior'; |
| 185 | + import { choosingReducedFee } from '../../../helpers/data/reduced-fee'; |
| 186 | + import { correctID } from '../../../helpers/data/card-type'; |
| 187 | +
|
| 188 | +
|
| 189 | + const Senior = (props) => { |
| 190 | + if (!gettingSeniorID(props.IDApp)) { return null; } |
| 191 | + return <Translator tag='p' translationPath = 'intro.getStartedPage.whatYouAreDoing.correctingSeniorID' /> |
| 192 | + }; |
| 193 | +
|
| 194 | + const Reduced = (props) => { |
| 195 | + if (!choosingReducedFee(props.IDApp)) { return null; } |
| 196 | + return <Translator tag='p' translationPath = 'intro.getStartedPage.whatYouAreDoing.correctingReducedFeeID' /> |
| 197 | + }; |
| 198 | +
|
| 199 | + const Regular = (props) => { |
| 200 | + if (gettingSeniorID(props.IDApp) || choosingReducedFee(props.IDApp)) { return null; } |
| 201 | + return <Translator tag='p' translationPath = 'intro.getStartedPage.whatYouAreDoing.correctingID' /> |
| 202 | + }; |
| 203 | +
|
| 204 | +
|
| 205 | + const CorrectingIDInfo = (props) => { |
| 206 | + if(!correctID(props)) { return null; } |
| 207 | + return ( |
| 208 | + <div className='correcting-id-info'> |
| 209 | + <Senior IDApp = {props.IDApp }/> |
| 210 | + <Reduced IDApp = {props.IDApp }/> |
| 211 | + <Regular IDApp = { props.IDApp}/> |
| 212 | + </div> |
| 213 | + ); |
| 214 | + }; |
| 215 | +
|
| 216 | + export default CorrectingIDInfo; |
| 217 | + EOJS |
| 218 | + |
| 219 | + create_source_file("bar.js", <<~EOJS) |
| 220 | + 'use strict'; |
| 221 | +
|
| 222 | + import React from 'react'; |
| 223 | + import { updateID } from '../../../helpers/data/card-type'; |
| 224 | + import { gettingSeniorID } from '../../../helpers/data/senior'; |
| 225 | + import { choosingReducedFee } from '../../../helpers/data/reduced-fee'; |
| 226 | + import Translator from '../../../i18n/translator-tag.jsx'; |
| 227 | +
|
| 228 | + const Senior = (props) => { |
| 229 | + if (!gettingSeniorID(props.IDApp)) { return null; } |
| 230 | + return <Translator tag='p' translationPath = 'intro.getStartedPage.whatYouAreDoing.updatingSeniorID' /> |
| 231 | + }; |
| 232 | +
|
| 233 | + const Reduced = (props) => { |
| 234 | + if (!choosingReducedFee(props.IDApp)) { return null; } |
| 235 | + return <Translator tag='p' translationPath = 'intro.getStartedPage.whatYouAreDoing.updatingReducedFeeID' /> |
| 236 | + }; |
| 237 | +
|
| 238 | + const Regular = (props) => { |
| 239 | + if (gettingSeniorID(props.IDApp) || choosingReducedFee(props.IDApp)) { return null; } |
| 240 | + return <Translator tag='p' translationPath = 'intro.getStartedPage.whatYouAreDoing.updatingID' /> |
| 241 | + }; |
| 242 | +
|
| 243 | + const UpdatingIDInfo = (props) => { |
| 244 | + if (!updateID(props)) { return null; } |
| 245 | + return ( |
| 246 | + <div className='updating-id-info'> |
| 247 | + <Senior IDApp = {props.IDApp } /> |
| 248 | + <Reduced IDApp = {props.IDApp } /> |
| 249 | + <Regular IDApp = { props.IDApp} /> |
| 250 | + </div> |
| 251 | + ); |
| 252 | + }; |
| 253 | +
|
| 254 | + export default UpdatingIDInfo; |
| 255 | + EOJS |
| 256 | + |
| 257 | + issues = run_engine(engine_conf).strip.split("\0") |
| 258 | + issues = issues.map { |issue| JSON.parse issue } |
| 259 | + |
| 260 | + infected = issues.any? { |i| i.dig("location", "lines", "begin") == 1 } |
| 261 | + |
| 262 | + expect(infected).to be false |
| 263 | + end |
| 264 | + |
177 | 265 | it "outputs the correct line numbers for ASTs missing line details (codeclimate/app#6227)" do
|
178 | 266 | create_source_file("foo.js", <<~EOJS)
|
179 | 267 | `/movie?${getQueryString({ movie_id: movieId })}`
|
|
0 commit comments