Semmle Code - Sample Query in .QL

Sample Query in .QL

To illustrate the use of .QL, consider the well-known rule in object-oriented programming that public fields should be declared final. To find violations of that rule, we should search for fields that are public but not final. In .QL, that requirement is expressed as follows:

from Field f where f.hasModifier("public") and not(f.hasModifier("final")) select f.getDeclaringType.getPackage, f.getDeclaringType, f

Here we select not only the offending field f, but also the package and type in which its declaration occurs.

Read more about this topic:  Semmle Code

Famous quotes containing the words sample and/or query:

    As a rule they will refuse even to sample a foreign dish, they regard such things as garlic and olive oil with disgust, life is unliveable to them unless they have tea and puddings.
    George Orwell (1903–1950)

    Such condition of suspended judgment indeed, in its more genial development and under felicitous culture, is but the expectation, the receptivity, of the faithful scholar, determined not to foreclose what is still a question—the “philosophic temper,” in short, for which a survival of query will be still the salt of truth, even in the most absolutely ascertained knowledge.
    Walter Pater (1839–1894)