Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QQmlJSLinter Class Reference

#include <qqmljslinter_p.h>

+ Collaboration diagram for QQmlJSLinter:

Classes

class  Plugin
 

Public Types

enum  LintResult { FailedToOpen , FailedToParse , HasWarnings , LintSuccess }
 
enum  FixResult { NothingToFix , FixError , FixSuccess }
 

Public Member Functions

 QQmlJSLinter (const QStringList &importPaths, const QStringList &pluginPaths={ QQmlJSLinter::defaultPluginPath() }, bool useAbsolutePath=false)
 
LintResult lintFile (const QString &filename, const QString *fileContents, const bool silent, QJsonArray *json, const QStringList &qmlImportPaths, const QStringList &qmldirFiles, const QStringList &resourceFiles, const QList< QQmlJS::LoggerCategory > &categories)
 
LintResult lintModule (const QString &uri, const bool silent, QJsonArray *json, const QStringList &qmlImportPaths, const QStringList &resourceFiles)
 
FixResult applyFixes (QString *fixedCode, bool silent)
 
const QQmlJSLoggerlogger () const
 
std::vector< Plugin > & plugins ()
 
void setPlugins (std::vector< Plugin > plugins)
 
void setPluginsEnabled (bool enablePlugins)
 
bool pluginsEnabled () const
 
void clearCache ()
 

Static Public Member Functions

static std::vector< PluginloadPlugins (QStringList paths)
 
static QString defaultPluginPath ()
 

Detailed Description

Definition at line 41 of file qqmljslinter_p.h.

Member Enumeration Documentation

◆ FixResult

Enumerator
NothingToFix 
FixError 
FixSuccess 

Definition at line 49 of file qqmljslinter_p.h.

◆ LintResult

Enumerator
FailedToOpen 
FailedToParse 
HasWarnings 
LintSuccess 

Definition at line 48 of file qqmljslinter_p.h.

Constructor & Destructor Documentation

◆ QQmlJSLinter()

QQmlJSLinter::QQmlJSLinter ( const QStringList importPaths,
const QStringList pluginPaths = QQmlJSLinter::defaultPluginPath() },
bool  useAbsolutePath = false 
)

Definition at line 68 of file qqmljslinter.cpp.

References loadPlugins().

+ Here is the call graph for this function:

Member Function Documentation

◆ applyFixes()

◆ clearCache()

void QQmlJSLinter::clearCache ( )
inline

Definition at line 132 of file qqmljslinter_p.h.

◆ defaultPluginPath()

QString QQmlJSLinter::defaultPluginPath ( )
static

Definition at line 63 of file qqmljslinter.cpp.

References QLibraryInfo::path(), QLibraryInfo::PluginsPath, and QDir::separator().

+ Here is the call graph for this function:

◆ lintFile()

QQmlJSLinter::LintResult QQmlJSLinter::lintFile ( const QString filename,
const QString fileContents,
const bool  silent,
QJsonArray json,
const QStringList qmlImportPaths,
const QStringList qmldirFiles,
const QStringList resourceFiles,
const QList< QQmlJS::LoggerCategory > &  categories 
)

Definition at line 416 of file qqmljslinter.cpp.

References QFileInfo::absoluteFilePath(), addJsonWarning(), QJsonArray::append(), QString::arg(), category(), QSet< T >::cbegin(), QSet< T >::cend(), QFileDevice::close(), QQmlJSScope::create(), QQmlJSScope::createQQmlSAElement(), QQmlJSTypeResolver::DoNotCloneTypes, engine, QFileDevice::error(), error, QIODevice::errorString(), FailedToOpen, FailedToParse, file, QQmlJSLogger::fileName(), QString::fromLatin1(), QString::fromUtf8(), QScopedPointer< T, Cleanup >::get(), QQmlJS::LoggerCategoryPrivate::get(), QQmlJS::LoggerCategoryPrivate::hasChanged(), QQmlJSLogger::hasErrors(), HasWarnings, QQmlJSLogger::hasWarnings(), QQmlJSImportVisitor::implicitImportDirectory(), QQmlJSImporter::importPaths(), info, QQmlJSTypeResolver::init(), interface, QList< T >::isEmpty(), it, LintSuccess, QQmlJSResourceFileMapper::localFileFilter(), QQmlJSLogger::log(), logger(), mapper, QQmlJS::LoggerWarningId::name(), QFile::open(), QQmlJSLogger::processMessages(), Q_ASSERT, qCompileQmlFile(), qmlImport, qmlSyntax, QStringLiteral, QtCriticalMsg, qWarning, QIODevice::readAll(), QIODeviceBase::ReadOnly, QQmlJSLogger::registerCategory(), QQmlSA::LintPlugin::registerPasses(), QScopedPointer< T, Cleanup >::reset(), QQmlJSLiteralBindingCheck::run(), QQmlJSLogger::setCategoryIgnored(), QQmlJSLogger::setCategoryLevel(), QQmlJSTypeResolver::setCloneMode(), QQmlJSLogger::setCode(), QQmlJS::Lexer::setCode(), QQmlJSLogger::setFileName(), QLoggingCategory::setFilterRules(), QQmlJSImporter::setImportPaths(), QQmlJSTypeResolver::setParentMode(), QQmlJSImporter::setResourceFileMapper(), QQmlJSLogger::setSilent(), QFileInfo::suffix(), QQmlJSImporter::takeGlobalWarnings(), QString::toLower(), and QQmlJSTypeResolver::UseDocumentParent.

Referenced by QmlLsp::QmlLintSuggestions::diagnose().

+ Here is the caller graph for this function:

◆ lintModule()

◆ loadPlugins()

std::vector< QQmlJSLinter::Plugin > QQmlJSLinter::loadPlugins ( QStringList  paths)
static

Definition at line 196 of file qqmljslinter.cpp.

References QDuplicateTracker< T, Prealloc >::hasSeen(), QLibrary::isLibrary(), it, plugins(), qWarning, and QPluginLoader::staticPlugins().

Referenced by QQmlJSLinter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ logger()

const QQmlJSLogger * QQmlJSLinter::logger ( ) const
inline

Definition at line 121 of file qqmljslinter_p.h.

Referenced by QmlLsp::QmlLintSuggestions::diagnose(), and lintFile().

+ Here is the caller graph for this function:

◆ plugins()

std::vector< Plugin > & QQmlJSLinter::plugins ( )
inline

Definition at line 123 of file qqmljslinter_p.h.

Referenced by loadPlugins().

+ Here is the caller graph for this function:

◆ pluginsEnabled()

bool QQmlJSLinter::pluginsEnabled ( ) const
inline

Definition at line 130 of file qqmljslinter_p.h.

◆ setPlugins()

void QQmlJSLinter::setPlugins ( std::vector< Plugin plugins)
inline

Definition at line 127 of file qqmljslinter_p.h.

◆ setPluginsEnabled()

void QQmlJSLinter::setPluginsEnabled ( bool  enablePlugins)
inline

Definition at line 129 of file qqmljslinter_p.h.


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