Skip to content

Commit

Permalink
Fix forcing filling Arguments field in New User Keyword dialog (#2674)
Browse files Browse the repository at this point in the history
* Fix forcing filling Arguments field in New User Keyword dialog

* Update Linux workflow for Fedora 39
  • Loading branch information
HelioGuilherme66 authored Nov 21, 2023
1 parent 5fa2ec0 commit 410e9f9
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 60 deletions.
1 change: 0 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ jobs:
- name: Setup environment
run: |
sudo dnf install -y sdl12-compat python3-wxpython4 xorg-x11-server-Xvfb python3-pip psmisc
sudo -H pip install wheel https://extras.wxpython.org/wxPython4/extras/linux/gtk3/fedora-38/wxPython-4.2.1-cp311-cp311-linux_x86_64.whl
sudo -H pip install -r requirements-dev.txt
- name: Run tests
run: |
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ All notable changes to this project will be documented in this file.
The format is based on http://keepachangelog.com/en/1.0.0/[Keep a Changelog]
and this project adheres to http://semver.org/spec/v2.0.0.html[Semantic Versioning].

// == https://github.com/robotframework/RIDE[Unreleased]
== https://github.com/robotframework/RIDE[Unreleased]

=== Fixed

- Fixed New User Keyword dialog not allowing empty Arguments field


== https://github.com/robotframework/RIDE/blob/master/doc/releasenotes/ride-2.0.8.1.rst[2.0.8.1] - 2023-11-01

Expand Down
72 changes: 37 additions & 35 deletions src/robotide/application/CHANGELOG.html

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/robotide/application/releasenotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def set_content(self, html_win, content):
</ul>
<p><strong>New Features and Fixes Highlights</strong></p>
<ul class="simple">
<li>Fixed New User Keyword dialog not allowing empty Arguments field</li>
<li>Fixed escaped spaces showing in Text Editor on commented cells</li>
<li>Improved keywords documentation search, by adding current dir to search</li>
<li>Improved Move up/down, <b>Alt-UpArrow</b>/<b>Alt-DownArrow</b> in Text Editor, to have proper indentation and selection</li>
Expand Down Expand Up @@ -249,6 +250,6 @@ def set_content(self, html_win, content):
<pre class="literal-block">
python -m robotide.postinstall -install
</pre>
<p>RIDE {VERSION} was released on 1/Nov/2023.</p>
<p>RIDE {VERSION} was released on 20/Nov/2023.</p>
</div>
"""
43 changes: 22 additions & 21 deletions src/robotide/validators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,27 +110,28 @@ def _get_type(arg):

@staticmethod
def _validate_argument_order(types):
prev = types[0]
active_named_only = False
dict_in_list = False
for idx, t in enumerate(types):
if prev == ArgumentTypes.DICT:
dict_in_list = True
if t == ArgumentTypes.NAMED:
active_named_only = True
prev = ArgumentTypes.DEFAULT # Force max value
continue
if idx == len(types)-1:
if t in [ArgumentTypes.LIST, ArgumentTypes.DICT] and not dict_in_list:
return None
elif t == ArgumentTypes.LIST and dict_in_list:
return "Only last argument can be kwargs (dictionary argument)."
if t < prev:
if ((not active_named_only and t not in [ArgumentTypes.LIST, ArgumentTypes.DICT])
or (active_named_only and t in [ArgumentTypes.LIST, ArgumentTypes.DICT])):
return ("List and scalar arguments must be before named and "
"dictionary arguments")
prev = t
if types:
prev = types[0]
active_named_only = False
dict_in_list = False
for idx, t in enumerate(types):
if prev == ArgumentTypes.DICT:
dict_in_list = True
if t == ArgumentTypes.NAMED:
active_named_only = True
prev = ArgumentTypes.DEFAULT # Force max value
continue
if idx == len(types)-1:
if t in [ArgumentTypes.LIST, ArgumentTypes.DICT] and not dict_in_list:
return None
elif t == ArgumentTypes.LIST and dict_in_list:
return "Only last argument can be kwargs (dictionary argument)."
if t < prev:
if ((not active_named_only and t not in [ArgumentTypes.LIST, ArgumentTypes.DICT])
or (active_named_only and t in [ArgumentTypes.LIST, ArgumentTypes.DICT])):
return ("List and scalar arguments must be before named and "
"dictionary arguments")
prev = t
return None


Expand Down
2 changes: 1 addition & 1 deletion src/robotide/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# limitations under the License.
#
# Automatically generated by `tasks.py`.
VERSION = 'v2.0.8.1'
VERSION = 'v2.0.9dev1'
8 changes: 8 additions & 0 deletions utest/validators/test_arguments_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ def test_req_arg_after_defaults(self):
for arg in ["${a}=default | ${a2}", "${a} | ${b}=default | ${c}"]:
assert self.validate(arg) == self.validation_error

def test_empty_argument_validation(self):
arg = ""
assert self.validate(arg) is None
arg = None
assert self.validate(arg) is None
arg = []
assert self.validate(arg) is None


if __name__ == '__main__':
unittest.main()

0 comments on commit 410e9f9

Please sign in to comment.