Exception::raise(): Unimplemented Parser Node: EmptyElse - sorbet

When running srb init in a Rails app I get the following:
Generating /tmp/d20220723-3779490-paqj5l/reflection.rbi with 6784 modules and 142 aliases
Printing your code's symbol table into /tmp/d20220723-3779490-paqj5l/from-source.json
/home/allan/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/sorbet-0.5.10206/lib/hidden-definition-finder.rb:123:in `write_constants': Your source can't be read by Sorbet. (RuntimeError)
You can try `find . -type f | xargs -L 1 -t bundle exec srb tc --no-config --isolate-error-code 1000` and hopefully the last file it is processing before it dies is the culprit.
If not, maybe the errors in this file will help: /tmp/d20220723-3779490-paqj5l/from-source.json.err
When I check that error file I find this:
Exception::raise(): Unimplemented Parser Node: EmptyElse
Is there a workaround to get past this error?

Anytime you see Exception::raise in a Sorbet error message, it means there was a bug in Sorbet. You can report Sorbet bugs at https://github.com/sorbet/sorbet/issues
I have created a fix for this bug here: https://github.com/sorbet/sorbet/pull/6161
It will require upgrading Sorbet before you can take advantage of the fix. If you can't wait for that, you will have to hunt down the file in your codebase that uses Ruby's new case ... in syntax for pattern matching with an empty else keyword, and either delete the else keyword or change it to mention else nil instead.
Sorry for the inconvenience.
In the future, please use https://github.com/sorbet/sorbet/issues to report all issues—I only happened to see this by accident today, but I normally do not monitor StackOverflow for bug reports.

Related

liquibase tagExist command exit code

i am using liquibase 3.4.1 in the command line way.
My command looks like this :
D:\Work>java -cp ".\*" liquibase.integration.commandline.Main --defaultsFile=liquibase_methods.properties tagExists 4.5
works pretty well :
The tag 4.5 does not exist in user#jdbc:oracle:thin:#url:port:SID
Liquibase 'tagExists' Successful
when I do echo %errorlevel%, the OS tells me 0, like the previous command was correcctly released.
is there a 'quite easy' way to get an exit code != 0 when the tagExists command returns that the tag doesn't exist ?
by 'quite easy' I mean also something more proper than parse the result text and look for keywords..
Regards,
Guillaume
This would require a change in the liquibase source code. Looking at the class src/main/java/liquibase/integration/commandline/Main.java you can see that whether there is an error or not, liquibase just does a return. This would need to be changed so that it did System.exit(int) and the system would need to be altered so that the commands themselves returned some sort of success code.
I think Nathan is working on improvements for 4.0, but for the 3.x line it seems like a fairly straightforward change. The issue with a change like this though is what unintended consequences it would have on other systems. I would suggest forking the project on github and making the change for yourself, and then creating a pull request to see if it can be added to the main line code.

How to force STORE (overwrite) to HDFS in Pig?

When developing Pig scripts that use the STORE command I have to delete the output directory for every run or the script stops and offers:
2012-06-19 19:22:49,680 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 6000: Output Location Validation Failed for: 'hdfs://[server]/user/[user]/foo/bar More info to follow:
Output directory hdfs://[server]/user/[user]/foo/bar already exists
So I'm searching for an in-Pig solution to automatically remove the directory, also one that doesn't choke if the directory is non-existent at call time.
In the Pig Latin Reference I found the shell command invoker fs. Unfortunately the Pig script breaks whenever anything produces an error. So I can't use
fs -rmr foo/bar
(i. e. remove recursively) since it breaks if the directory doesn't exist. For a moment I thought I may use
fs -test -e foo/bar
which is a test and shouldn't break or so I thought. However, Pig again interpretes test's return code on a non-existing directory as a failure code and breaks.
There is a JIRA ticket for the Pig project addressing my problem and suggesting an optional parameter OVERWRITE or FORCE_WRITE for the STORE command. Anyway, I'm using Pig 0.8.1 out of necessity and there is no such parameter.
At last I found a solution on grokbase. Since finding the solution took too long I will reproduce it here and add to it.
Suppose you want to store your output using the statement
STORE Relation INTO 'foo/bar';
Then, in order to delete the directory, you can call at the start of the script
rmf foo/bar
No ";" or quotations required since it is a shell command.
I cannot reproduce it now but at some point in time I got an error message (something about missing files) where I can only assume that rmf interfered with map/reduce. So I recommend putting the call before any relation declaration. After SETs, REGISTERs and defaults should be fine.
Example:
SET mapred.fairscheduler.pool 'inhouse';
REGISTER /usr/lib/pig/contrib/piggybank/java/piggybank.jar;
%default name 'foobar'
rmf foo/bar
Rel = LOAD 'something.tsv';
STORE Rel INTO 'foo/bar';
Once you use the fs command, there a lot of ways to do this. For an individual file, I wound up adding this to the beginning of my scripts:
-- Delete file (won't work for output, which will be a directory
-- but will work for a file that gets copied or moved during the
-- the script.)
fs -touchz top_100
rm top_100
For a directory
-- Delete dir
fs -rm -r out

Objective C, CABase.h file error

I hate Xcode 4! It crashes all the time and finally it gives me an error in CABase.h file which is an library header file that I am not allowed to modify..
I don't even know how this file is broken.
How to fix this problem? It complains like
"Expected *before*
Expected '=',',',';','asm' or '_attribute_' before 'extern'
Also, how can I completely remove Xcode on my Mac and re-install?
You probably just have a simple error, perhaps in a header which is included prior to CABase.h. Use a "divide and conquer" strategy to locate it.
To answer your last question:
$ sudo /Developer/Library/uninstall-devtools –mode=all
This happened to me just because I had the letter 's' at the beginning of one of my implementation files. I must have missed the cmd key when cmd+s for saving the file. Luckily, another compile error discovered this and removing the 's' fixed both errors.
For example,
s//
// GraphingViewController.m

How to use Doxygen with Xcode?

I'm trying to use Doxygen with Xcode. I followed the Apple tutorial. After several mistakes, I builded the project and generated the docs. I discovered that if you save the doxygen.config from Doxygen and you use space " " in the directory name you will have problem and others things.
But there is one last problem:
./search/search.png
./tab_b.gif
./tab_l.gif
./tab_r.gif
./tabs.css
/Developer/usr/bin/docsetutil index com.mycompany.DoxygenExample.docset
2010-03-31 12:30:53.847 docsetutil[46338:807] Error converting XML to CoreData: Error Domain=NSXMLParserErrorDomain Code=76 UserInfo=0x1247d0 "Line 8: Opening and ending tag mismatch: Subnodes line 0 and Node
"
Failed to create docset indexer object
make: *** [docset] Error 1
load documentation set with path "/Users/WB/Library/Developer/Shared/Documentation/DocSets/"
I don't know what is the problem?? Any idea?
I'm using Core Data - sqlite.
The parser is telling you XML is not well formed, but that error usually shows because nothing has been generated BEFORE running docsetutil.
First thing should be to go over the many lines of console output and look for warnings, probably is there. Also look for the docset you generated and right click > Show Contents. If you don't see a lot of html files with the documentation, same thing: you failed at generating documentation and docsetutil has nothing to do. And btw, it's docsetutil who is using CoreData, doesn't matter if you use it on your project or not.
I don't get why Apple doesn't provide a doxygen-like tool more tightly integrated. Or a better code formatter than Crustify. Just take the damn tools and improve them a little bit. Argh!
There is a know bug from generation of Nodes.xml by Doxygen. It is referenced here https://bugzilla.gnome.org/show_bug.cgi?id=671591 and should be corrected in the next doxygen Version (Post V 1.8.0) :
At the end of the Nodes.xml there is an additional
the -silence option is workaround to suppress error, but this param does not allow dosetgeneration to work properly.
$DOXYGEN_PATH $TEMP_DIR/doxygen.config
make -C $TEMP_DIR/DoxygenDocs.docset/html install
Insert following code
Note : The script works in $TEMP_DIR and not in SOURCE_ROOT as AppleScript
$DOXYGEN_PATH $TEMP_DIR/doxygen.config
# make will invoke docsetutil. Take a look at the Makefile to see how this is done.
LINE=`xmllint --c14n $TEMP_DIR/DoxygenDocs.docset/html/Nodes.xml 2>&1 | awk 'NR == 1 {print $1}' | cut -d':' -f 2`
ECHO $LINE
if [ $LINE -gt 0 ]
then
echo "XML Cleaning "
sed -i.bak $LINE'd' $TEMP_DIR/DoxygenDocs.docset/html/Nodes.xml
fi
make -C $TEMP_DIR/DoxygenDocs.docset/html install
NB: awk and sed may certainly be combined in one line.
So the long story short is that the script creates a Doxyfile on the fly, and it does not recursively scan all subdirectories.
Take a look at this post:
http://www.duckrowing.com/2010/03/18/documenting-objective-c-with-doxygen-part-ii/
There's a script included on the second post that is based on Apple's script that shouldn't have this issue.
I use an extended version of the above script but based on the same priniciples. Although everything works fine on another project this time my script fails.
The generation of the docset works fine but the make command produces the following error.
x ./search/search_r.png
2010-07-26 17:36:01.815 docsetutil[8441:903]
Error converting XML to CoreData:
Error Domain=NSXMLParserErrorDomain
Code=76
UserInfo=0x1006105e0
"Line 8: Opening and ending tag mismatch: Subnodes line 0 and Node"
Failed to create docset indexer object
make: *** [docset] Error 1
The make command I use is: make --silent -C "$DOCSET_OUTPUT/html" install.
I added line breaks to the error message for readability.

Using WinMerge with Bazaar

I searched a lot, found that some people claimed they did that, but I can't make it to work.
How to you use WinMerge, my favorite diff tool on Windows, with Bazaar?
I know difftools plugin (shipped with Bazaar) handles this but the controller.py file doesn't list it, and I fail to see where to specify a path. Looks like it searches in PATH variable, and reports bzr: ERROR: Cannot find 'winmerge' in (long list of paths).
I tried to put a .cmd file, then a shortcut to WinMergeU.exe in Bazaar's directory, renaming accordingly (winmerge.cmd, winmerge.lnk) the register_diff_tool parameter. No more error, but nothing is launched...
So, does somebody has any success using WinMerge (or perhaps some other Windows tool) with Bazaar?
I would be interested to use it with extmerge plugin too...
EDIT After the first two answers, I tried some variants which I list here for reference. None worked:
# As suggested:
# Bad: bzr: ERROR: [Errno 22] Invalid argument: 'c:\\docume~1\\philho\\locals~1\\temp\\bzr_C:/Program Files/_Text/WinMerge/WinMergeU.exeh7angm.log'
wdiff = diff --using "C:/Program Files/_Text/WinMerge/WinMergeU.exe"
# Bad: bzr: ERROR: Cannot find 'C:Progra~1_TextWinMergeWinMergeU.exe' in <PATH>
wdiff = diff --using C:\Progra~1\_Text\WinMerge\WinMergeU.exe
# Variants:
# Bad: bzr: ERROR: [Errno 22] Invalid argument: 'c:\\docume~1\\philho\\locals~1\\temp\\bzr_C:/Progra~1/_Text/WinMerge/WinMergeU.exejuttft.log'
wdiff = diff --using C:/Progra~1/_Text/WinMerge/WinMergeU.exe
# Bad: bzr: ERROR: [Errno 22] Invalid argument: 'c:\\docume~1\\philho\\locals~1\\temp\\bzr_C:\\Program Files\\_Text\\WinMerge\\WinMergeU.exehpabjl.log'
wdiff = diff --using "C:\\Program Files\\_Text\\WinMerge\\WinMergeU.exe"
# Bad: bzr: ERROR: [Errno 22] Invalid argument: 'c:\\docume~1\\philho\\locals~1\\temp\\bzr_C:\\Progra~1\\_Text\\WinMerge\\WinMergeU.exe4gi5or.log'
wdiff = diff --using C:\\Progra~1\\_Text\\WinMerge\\WinMergeU.exe
Using:
Bazaar (bzr) 1.11
Python interpreter: C:\Program Files\_Dev\Bazaar\python25.dll 2.5.2
Actually, the awful (and embarrassing) truth is that it appears that one of my earlier attempts worked, but I saw nothing... because I was testing against a committed file! I suppose I was expecting that by default it compared last two revisions or something.
Anyway, as I wrote in a comment, I don't want to put WinMerge directory in my already too long path, so I took at middle road, making a command file and putting it in Bazaar's directory which is already in the path.
At least it works, and I can easily add parameters if needed.
[ALIASES]
wdiff = diff --using winmerge.cmd
# winmerge.cmd contains:
"C:\Program Files\_Text\WinMerge\WinMergeU.exe" %1 %2
Maybe I should put that as solution in the thread, although it lacks elegance.
For the record, while we are on the topic of external tools, I also added to bazaar.conf:
editor = C:/Program Files/_Text/SciTE/SciTE.exe
It is used by commit (without -m option), for example.
Next step: extmerge. Looking closer, it doesn't seem WinMerge is usable there, not having 3-way merge. I might use Perforce's merge, it is free and I am used to it.
Just a note for those as confused as me: extmerge isn't a GUI replacement for merge. If you run it, it will report no conflict, even if merge reports them. Actually, you have to run merge first, then extmerge to use the generated/altered files and do the job...
If you want to use WinMerge anyway, perhaps to compare OTHER to THIS, you can use:
external_merge = "C:/Program Files/_Text/WinMerge/WinMergeU.exe %o %t %r"
I hope my attempts/remarks here will be useful to some other people... :-)
[UPDATE]
Oookaaay!
So I was confused! A message in the Bazaar mailing list enlightened my poor soul:
"You know that bzr also provides diff --using, right? You prefer the version in difftools?" -- Aaron Bentley, 2009-04-03 in Re: difftools, ‘bzr diff --using footool’, and ‘diffuse’
Aargh! No, I didn't know that.
I removed difftools plugin, edited my line to:
wdiff = diff --using "C:/Program Files/_Text/WinMerge/WinMergeU.exe"
and it worked perfectly fine, out of the box! I am not sure why this difftools plugin isn't marked as obsolete.
I leave this question as a reference in case other newbies like me are confused too. And I can at least elect an answer. Thanks!
bzr diff --using "C:/Program Files/WinMerge/WinMergeU.exe"
You can add this to aliases in bazaar.conf
Or, if you have C:\Program Files\WinMerge in your PATH environment variable you can use it as:
bzr diff --using WinMergeU.exe
Did you read the README file that came with the difftools plugin? It explained the --using option.
Also, going by bazaar installed on my windows machine, which hasn't been updated in a while, you'll find your config file in C:\Documents and Settings\username\Application Data\bazaar\2.0\bazaar.conf
Add the following under the [ALIASES] section (adding that section if it doesn't exist):
[ALIASES]
gdiff = diff --using C:\Progra~1\WinMerge\WinMergeU.exe
Change the path to suit your installation. Then you can just go
bazaar gdiff
instead of
bazaar diff
This seemed to work for me:
bzr diff --using "C:\\program files\\winmerge\\winmergeu.exe"
As an aside, if you can't get it working, I would suggest using the q* UI tools, like:
bzr qdiff
bzr qlog
bzr qcommit
..etc
The Tortoise Bazaar->Settings->General Bazaar Options->Diff->Add not works for me. I try to use the answers above, but unfortunately they not works too. But I used the answers for a base, and I find a solution. I edited the
C:\Documents and Settings\*username*\Application Data\bazaar\2.0\qbazaar.conf (not bazaar.conf)
and added the line
[EXTDIFF]
WinMerge = "C:/Program Files/TC UP/PLUGINS/Media/WinMerge/WinMergeU.exe"
It works fine, and I can choose between the builtin diff and the WinMerge.