https://mooseframework.inl.gov
Public Member Functions | Public Attributes | Private Attributes | List of all members
Moose::UnusedWalker Class Reference

#include <Builder.h>

Inheritance diagram for Moose::UnusedWalker:
[legend]

Public Member Functions

 UnusedWalker (std::set< std::string > used, Builder &p)
 
void walk (const std::string &fullpath, const std::string &nodename, hit::Node *n) override
 

Public Attributes

std::vector< std::string > errors
 

Private Attributes

std::set< std::string > _used
 
Builder_builder
 

Detailed Description

Definition at line 39 of file Builder.h.

Constructor & Destructor Documentation

◆ UnusedWalker()

Moose::UnusedWalker::UnusedWalker ( std::set< std::string >  used,
Builder p 
)
inline

Definition at line 42 of file Builder.h.

42 : _used(used), _builder(p) {}
Builder & _builder
Definition: Builder.h:50
std::set< std::string > _used
Definition: Builder.h:49

Member Function Documentation

◆ walk()

void Moose::UnusedWalker::walk ( const std::string &  fullpath,
const std::string &  nodename,
hit::Node *  n 
)
override

Definition at line 179 of file Builder.C.

180 {
181  // the line() > 0 check allows us to skip nodes that were merged into this tree (i.e. CLI
182  // args) because their unused params are checked+reported independently of the ones in the
183  // main tree.
184  if (!_used.count(fullpath) && nodename != "active" && nodename != "inactive" &&
185  isSectionActive(fullpath, n->root()) && n->line() > 0)
186  {
187  auto section_name = fullpath.substr(0, fullpath.rfind("/"));
188  auto paramlist = _builder.listValidParams(section_name);
189  auto candidates = findSimilar(nodename, paramlist);
190  if (candidates.size() > 0)
191  errors.push_back(hit::errormsg(
192  n, "unused parameter '", fullpath, "'\n", " Did you mean '", candidates[0], "'?"));
193  else
194  errors.push_back(hit::errormsg(n, "unused parameter '", fullpath, "'"));
195  }
196 }
Builder & _builder
Definition: Builder.h:50
std::vector< std::string > errors
Definition: Builder.h:46
std::set< std::string > _used
Definition: Builder.h:49
std::vector< std::string > listValidParams(std::string &section_name)
Definition: Builder.C:162
std::vector< std::string > findSimilar(std::string param, std::vector< std::string > options)
Definition: Builder.C:97
bool isSectionActive(std::string path, hit::Node *root)
Definition: Builder.C:60

Member Data Documentation

◆ _builder

Builder& Moose::UnusedWalker::_builder
private

Definition at line 50 of file Builder.h.

Referenced by walk().

◆ _used

std::set<std::string> Moose::UnusedWalker::_used
private

Definition at line 49 of file Builder.h.

Referenced by walk().

◆ errors

std::vector<std::string> Moose::UnusedWalker::errors

Definition at line 46 of file Builder.h.

Referenced by Moose::Builder::errorCheck(), and walk().


The documentation for this class was generated from the following files: