VisionEval/VisionEval-Dev

Safety module failing tests and code cleanness checking

Closed this issue · 1 comments

The following items come up when building VETravelPerformance with the safety module:

  1. Many unscoped variables (undefined "globals"):
checking R code for possible problems (7s)
   CalculateMpgMpkwhAdjustments : getModelCoeff: no visible binding for
     global variable 'AdvVehType'
   CalculateMpgMpkwhAdjustments : getModelCoeff: no visible binding for
     global variable 'FacilityType'
   CalculateSafetyMeasures: no visible global function definition for
     'getFromNamespace'
   CalculateSafetyMeasures: no visible binding for global variable
     'BikeTrips'
   CalculateSafetyMeasures: no visible binding for global variable
     'BikeAvgTripDist'
   CalculateSafetyMeasures: no visible binding for global variable
     'WalkTrips'
   CalculateSafetyMeasures: no visible binding for global variable
     'WalkAvgTripDist'
   CalculateSafetyMeasures: no visible binding for global variable 'Marea'
   CalculateSafetyMeasures: no visible binding for global variable
     'BikeMT'
   CalculateSafetyMeasures: no visible binding for global variable
     'WalkMT'
   CalculateSafetyMeasures: no visible binding for global variable
     'WalkPMT'
   CalculateSafetyMeasures: no visible binding for global variable
     'BikePMT'
   CalculateSafetyMeasures: no visible binding for global variable
     'AutoFatal'
   CalculateSafetyMeasures: no visible binding for global variable
     'RuralHhDvmt'
   CalculateSafetyMeasures: no visible binding for global variable
     'AutoInjur'
   CalculateSafetyMeasures: no visible binding for global variable
     'UrbanHhDvmt'
   CalculateSafetyMeasures: no visible binding for global variable
     'TownHhDvmt'
   CalculateSafetyMeasures: no visible binding for global variable
     'BusFatal'
   CalculateSafetyMeasures: no visible binding for global variable
     'BusDvmt'
   CalculateSafetyMeasures: no visible binding for global variable
     'BusInjur'
   CalculateSafetyMeasures: no visible binding for global variable
     'RailFatal'
   CalculateSafetyMeasures: no visible binding for global variable
     'RailDvmt'
   CalculateSafetyMeasures: no visible binding for global variable
     'RailInjur'
   CalculateSafetyMeasures: no visible binding for global variable
     'VanDvmt'
Undefined global function     Undefined global functions or variables:
     AdvVehType AutoFatal AutoInjur BikeAvgTripDist BikeMT BikePMT
     BikeTrips BusDvmt BusFatal BusInjur FacilityType Marea RailDvmt
     RailFatal RailInjur RuralHhDvmt TownHhDvmt UrbanHhDvmt VanDvmt
     WalkAvgTripDist WalkMT WalkPMT WalkTrips getFromNamespace
   Consider adding
     importFrom("utils", "getFromNamespace")
   to your NAMESPACE file.
  1. The test routines do not run (and consequently Travis-CI fails since it always does the tests):
v Saving 'CalculateSafetyMeasuresSpecifications' to 'data/CalculateSafetyMeasuresSpecifications.rda'
* Document your data (see 'https://r-pkgs.org/data.html')
[1] "2020-08-03 17:31:33 : Testing CalculateSafetyMeasures."
[1] "2020-08-03 17:31:33 : Attempting to load datastore."
[1] "2020-08-03 17:31:33 : Datastore loaded."
[1] "2020-08-03 17:31:33 : Attempting to load and check specifications."
[1] "2020-08-03 17:31:33 : Module specifications successfully loaded and checked for errors."
[1] "2020-08-03 17:31:33 : Attempting to process, check and load module inputs."
Error in (function (ModuleName, ParamDir = "defs", RunParamFile = "run_parameters.json",  : 
  Input files for module CalculateSafetyMeasures have errors. Check the log for details.
Calls: source ... withVisible -> eval -> eval -> doTests -> do.call -> <Anonymous>
In addition: Warning messages:
1: In as.POSIXlt.POSIXct(x, tz) : unknown timezone 'EST+5EDT'
2: In dir.create(file.path(DatastoreName, Group, Table)) :
  'Datastore\Global\OtherOpsEffectiveness' already exists
3: In (function (ModuleName, ParamDir = "defs", RunParamFile = "run_parameters.json",  :
  Specifications check for module 'CalculateRoadDvmt' generated one or more warnings. Check log for details.
4: In (function (ModuleName, ParamDir = "defs", RunParamFile = "run_parameters.json",  :
  Specifications check for module 'CalculateRoadDvmt' generated one or more warnings. Check log for details.
5: In (function (ModuleName, ParamDir = "defs", RunParamFile = "run_parameters.json",  :
  Specifications check for module 'CalculateRoadPerformance' generated one or more warnings. Check log for details.
6: In (function (ModuleName, ParamDir = "defs", RunParamFile = "run_parameters.json",  :
  Specifications check for module 'CalculateRoadPerformance' generated one or more warnings. Check log for details.
7: In (function (ModuleName, ParamDir = "defs", RunParamFile = "run_parameters.json",  :
  Specifications check for module 'CalculateVehicleOperatingCost' generated one or more warnings. Check log for details.
8: In (function (ModuleName, ParamDir = "defs", RunParamFile = "run_parameters.json",  :
  Specifications check for module 'BalanceRoadCostsAndRevenues' generated one or more warnings. Check log for details.
Execution halted

FYI, the test log for the failed test contains this text, so there seems to be a missing data file. Do any of the test models (e.g. VERSPM) use the Safety module?

Test
Test of VESimHouseholds package modules
2020-08-03_17:31:33

2020-08-03 17:31:33 : Testing CalculateSafetyMeasures.
2020-08-03 17:31:33 : Attempting to load datastore.
2020-08-03 17:31:33 : Datastore loaded.
2020-08-03 17:31:33 : Attempting to load and check specifications.
2020-08-03 17:31:33 : Module specifications successfully loaded and checked for errors.
2020-08-03 17:31:33 : Attempting to process, check and load module inputs.
2020-08-03 17:31:33 : Input file error. File ' marea_safety_factors.csv ' required by ' CalculateSafetyMeasures ' is not present in the 'inputs' directory.

Closing this issue, in favor of #28