clang-format still formatting with `DisableFormat: true` - clang-format

As documentation states:
DisableFormat (bool): Disables formatting completely.
But checking a source C++ file with having only this option in .clang-format still reports that the file needs formatting.

Apparently (at least with clang-format 8.0) DisableFormat: true does not override SortIncludes option, so that it also needs to be specified explicitly. Having the following in .clang-format will disable formatting completely:
DisableFormat: true
SortIncludes: false
UPDATE 1
There's also an issue report for Version 5.0 that hasn't got any attention up to now.
UPDATE 2
The issue is fixed in Version 13.0.

Related

configure Saxon in eXist-db 5+ for xinclude

As of version 5.0 eXist-db no longer supports dynamically passing the option expand-xincludes=no to the Saxon processor during serialization. As such, I have to configure this in a Saxon config file. However this configuration does not seem to work - the xincludes are still being expanded in output.
Steps:
Following this comment and Saxon docs I created a configuration file called saxon-config.xml with the #xInclude="false" parameter:
<configuration xmlns="http://saxon.sf.net/ns/configuration" edition="HE">
<global xInclude="false"/>
</configuration>
I saved this in eXist's /etc/ directory and pointed to this file in the attribute in eXist's conf.xml:
<transformer class="net.sf.saxon.TransformerFactoryImpl" caching="no">
<attribute name="http://saxon.sf.net/feature/version-warning" value="false" type="boolean"/>
<attribute name="http://saxon.sf.net/feature/configuration-file" value="/Applications/eXist-db-5.2/etc/saxon-config.xml" type="string"/>
</transformer>
Yet the serializer still expands all the xincludes on output.
As a test to see if Saxon is reading the config, I put a deliberate error in the Saxon config file and Saxon objected.
Have I configured this for xInclude correctly?
--- adding more about workflow ---
Serialization in eXist 5.0 is performed in Xquery with the function fn:serialize().
I obtain a node (testing shows that this action does not expand xi:includes automatically in eXist) = $mydoc
I pass the node to the function with certain parameters, for example
fn:serialize($mydoc, map {"indent":true(),"method":"xml", "omit-xml-declaration":false()})
Output has expanded xinclude
I noticed this message on a recent mailing list, perhaps it's relevant.
My reading of this is that it's eXist doing the serialization with XInclude expansion, and this has nothing to do with Saxon. This doesn't solve your problem but hopefully it means you will be able to look in the right place for a solution; nothing you do with Saxon configuration options is going to make any difference.
Hi Ihe,
See the eXist documentation on XInclude, particularly the section on error handling:
https://exist-db.org/exist/apps/doc/xinclude
Joe
On Thu, Jun 18, 2020 at 7:50 AM Ihe Onwuka <ihe.onwuka#gmail.com> wrote:
5.2.0
On Thu, Jun 18, 2020 at 6:31 AM Jean-Paul Rehr <rehrjb#gmail.com> wrote:
Which version of eXist? Prior to 5.0 you can use
declare option exist:serialize "expand-xincludes=no";
in your Xquery declarations to allow/disallow Xinclude expansion (assuming you are using Xquery to execute the transformation). After 5.0...this no longer has an effect. Hopefully it will be reintroduced or another method discovered (see https://github.com/eXist-db/exist/issues/3446).
On Thu, Jun 18, 2020 at 11:12 AM Ihe Onwuka <ihe.onwuka#gmail.com> wrote:
A short while ago I wrote a transform that was supposed to transform a certain input element to an Xinclude element.
eXist blew up because it tried to resolve Xinclude call as soon as I attempted to store the transformation in the database.
Is that supposed to happen? Including the xsl list because am wondering whether this was a use case for namespace aliasing.
I have since solved the problem another way so the question is of academic interest only.
_______________________________________________
Exist-open mailing list
Exist-open#lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/exist-open

How can I enable clang-tidy's "modernize" checks?

I just installed ClangOnWin,and I'm trying to get clang-tidy's "modernize" checks to work. Unfortunately, clang-tidy doesn't seem to know about them: clang-tidy -list-checks foo.cpp -- | grep modernize produces no output.
The "modernize" checks are listed here, but that page seems to document Clang 3.8, and the version I have installed is 3.7. However, version 3.7 is the current one listed at the LLVM Download Page.
clang-tidy knows about a variety of security checks, so I think I have it installed correctly. For example, clang-tidy -list-checks foo.cpp -- | grep security yields this:
clang-analyzer-security.FloatLoopCounter
clang-analyzer-security.insecureAPI.UncheckedReturn
clang-analyzer-security.insecureAPI.getpw
clang-analyzer-security.insecureAPI.gets
clang-analyzer-security.insecureAPI.mkstemp
clang-analyzer-security.insecureAPI.mktemp
clang-analyzer-security.insecureAPI.rand
clang-analyzer-security.insecureAPI.strcpy
clang-analyzer-security.insecureAPI.vfork
Is there something special I need to do to enable checks such as modernize-use-override and modernize-use-nullptr?
The modernize checks were added after 3.7 (ported from clang-modernize), but try adding -checks="*" to see the whole list of available checks.
clang-tidy -list-checks -checks="*" foo.cpp --
Have you tried with the official binaries from LLVM: http://llvm.org/releases/download.html ? Maybe the ClangOnWin binaries are not compiled with all options, or something of that kind.

phpinfo displays date.timezone warning in MAMP

I ran a phpinfo() function in MAMP, and received the following warning, embedded in the php info table:
Warning: phpinfo() [function.phpinfo]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EST/-5.0/no DST' instead in /Applications/MAMP/bin/mamp/phpinfo.php on line 2
the date.timezone in the php.ini file is set to 'America/New_York', and the warning is only three rows above that actual setting reflected in the phpinfo table!
Could someone please explain to me how to fix this issue?
You're certain there are no quotes around the timezone in the .ini file?
date.timezone = America/New_York
http://www.php.net/manual/en/timezones.america.php#85815

JSLint : how to use it?

I've understood that JSLint is a great tool for JavaScript development but I've some dark points in my global comprehension of this.
How to use it inside my development environment ? In other words how and when do you run JSLint against your code ? I've seen the Aptana integration but it seems that it doesn't take into account statements like :
/* jslint nomen: false */
How to work correctly in a client side development environment ? I want JSLint to feel good when parsing calls including objects like "console", "$" or "JQuery".
How to use it on a whole project with multiple files (with no import statement inside of them) ?
I've read to much statement suggesting to copy paste on jslint to sleep correctly, so any answer consisting of configuring the online JSLint form would be considered as irrelevant.
I'm sorry to write this answer which is not really one. The best solution I've found is to use JSHint which is a concurrent to JSLint with some nice extra features :
Installation is made easy through NPM with command like (also works for JSLint), NPM is required :
npm install -g jshint
Execution is made easy against a lot of file (doesn't work for JSLint) :
jshint mycodedirectory
Configuration is possible through the --config options, config files look like :
{
"curly":true,
"eqeqeq": true,
"immed": true,
"bitwise": true,
"newcap": true,
"noempty": true,
"unused": true,
"camelcase":true,
"undef": true,
"strict": true,
"trailing": true,
"maxparams": 7,
"maxdepth": 5,
"maxstatements": 50,
"maxcomplexity": 13
}
This solution works for both browser and server code, it's IDE and OS independent, it can be easily integrated in continuous integration process.
Some one came up with a solution to run it automatically on your project using node.js:
Automating JSLint Validation
I use (a slightly modified) JSLINT for WSH on Emacs/WinXP. It highlights problematic code right while I am typing:
This is of great help not only to enforce the configured coding style, but also to find many JavaScript syntax errors before executing code.
It does respect statements such as /* jslint nomen: false */.
As you are asking concerning linting code that runs in a browser environment with jQuery, simply use standard JSLint options:
/*jslint browser: true */
/*global $ */
Just be sure to replace the included JSLint code with the latest version.

How to programmatically check LOVE2D version

How would one go about making sure that a .love file only runs if the current version of LOVE2D is better than a given minimum version? Without some sort of check, the resulting errors can be obscure and seemingly unrelated to the LOVE version, requiring the user to waste a lot of time trying to diagnose issues based on misleading errors.
You can add t.version = "0.8.0" to your conf.lua and it will warn the user if he is using a version other than 0.8.0. You shouldn't block mismatched versions, you should warn them.
Here's an example of conf.lua:
function love.conf(t)
t.title = "Game title"
t.author = "Your name"
t.version = "0.8.0"
end
Here's the wiki article on conf.lua.

Resources