Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Error shadows checkArgumentType warning #1167

Open
Iximiel opened this issue Dec 18, 2024 · 0 comments
Open

[Bug] Error shadows checkArgumentType warning #1167

Iximiel opened this issue Dec 18, 2024 · 0 comments

Comments

@Iximiel
Copy link
Member

Iximiel commented Dec 18, 2024

The CI is failing on /regtest/secondarystructure/rt-coverage-antibetarmsd, see #1166
I found an error that may not be linked directly to that test failure:

The Error text is quite cryptic:

Caution

WARNING: type for input argument has not been specified

Because it does not specify the Action that generates the problem

The "warning" that raises the error is raised here:

/*** from tools/Keywords.cpp ***/
bool Keywords::checkArgumentType( const std::size_t& rank, const bool& hasderiv ) const {
  for(auto const& x : argument_types ) {
    if( rank==0 && x.second.find("scalar")!=std::string::npos ) return true;
    if( hasderiv && x.second.find("grid")!=std::string::npos ) return true;
    if( rank==1 && x.second.find("vector")!=std::string::npos ) return true;
    if( rank==2 && x.second.find("matrix")!=std::string::npos ) return true;
  }
  plumed_merror("WARNING: type for input argument has not been specified");
  return false;
}

and shadows the original intended WARNING message, which reports the name of the action that generates the WARNING:

/*** from core/ActionWithArguments.cpp ***/
void ActionWithArguments::interpretArgumentList(const std::vector<std::string>& c, const ActionSet& as, Action* readact, std::vector<Value*>&arg) {
  /*a lot of other code*/
  for(unsigned i=0; i<arg.size(); ++i) {
    if( !readact->keywords.checkArgumentType( arg[i]->getRank(), arg[i]->hasDerivatives() ) ){
     readact->warning("documentation for input type is not provided in " + readact->getName() );
    }
  }
}

I think the intended use was to transform the warning into an error
and that /regtest/secondarystructure/rt-coverage-antibetarmsd

I'm opening a PR with the ->warning changed to ->error as soon I verify some other things

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant