File: README.md

package info (click to toggle)
gla11y 0.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 392 kB
  • sloc: python: 955; makefile: 64
file content (167 lines) | stat: -rw-r--r-- 5,041 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
GLA11Y (glade accessibility)
======

This tool checks accessibility of GtkBuilder .ui files
produced e.g. by glade.
It looks for various issues, and notably missing or bogus labelling
relations.

It can for instance be used in Continous Integration checks to make sure not to
introduce accessibility regressions.


This file describes the tool itself.

The HOWTO.md file describes how to fix the warnings raised by the tool.


Installation
------------

Just run

	make install

and gla11y will be installed in /usr/local/bin/ by default (can be changed by
appending prefix=... on the make command line).


Basic use
---------

The typical use is running

	gla11y $(find . -name \*.ui)

which will emit all kinds of warnings.


Using suppressions
------------------

If there are a lot of warnings for existing issues, it may be preferrable for a
start to only show new warnings: run once

	gla11y -g suppressions $(find . -name \*.ui)

to create a `suppressions' file which contains rules to suppress the warnings
found at the time of generation, and after that,

	gla11y -s suppressions $(find . -name \*.ui)

will only display warnings for new issues.

If the paths given to the tool are absolute, the -P option allows to remove a
prefix from the paths.


Application-specific widgets
----------------------------

By default, gla11y knows about Gtk standard widgets.  If the application has
its own self-baked widgets, it may be useful to teach gla11y their role, for
instance:

	gla11y --widgets-ignored +myVBox,myHBox --widgets-needlabel +myEntry $(find . -name \*.ui)

The default list of recognized widgets can be obtained with --widgets-print.


Enabling/Disabling warnings
---------------------------

Especially when starting running gla11y over a very big project with a lot
of existing warnings, it is useful to enable warnings progressively. The
--enable/disable options can be used to that end. Their effect accumulate, i.e.
each --enable/disable option overrides the effect of previous options. For
instance:

	gla11y --disable-all --enable-type undeclared-target $(find . -name \*.ui)

will only enable the undeclared-target warning type, while

	gla11y --enable-all --disable-specific no-labelled-by,GtkSpinner $(find . -name \*.ui)

will enable all warnings, except no-labelled-by for GtkSpinner widgets.


Fatal errors/warnings
---------------------

By default, only errors are fatal.  One can however fine-tune this, for instance:

	gla11y --fatal-all --not-fatal-widgets myWidget $(find . -name \*.ui)

makes all warnings (and errors) fatal except for myWiget widgets.  Conversely

	gla11y --not-fatal-all --fatal-type undeclared-target $(find . -name \*.ui)

makes all warnings and errors non-fatal, except error undeclared-target.


False positives
---------------

We have taken great care to avoid false positives, but sometimes they just can't
be detected automatically :) The simplest way to avoid them is then to blacklist
them. The -f option can be used like -s to suppress warnings, except that they
will not be reported at all any more.

This means that after creating a suppression file that silents the existing
errors to concentrate first on avoiding new accessibility issues, one can work
on warnings for existing issues by either fixing them, or moving the suppression
line from the suppression file passed to the -s option to the suppression file
passed to the -f option.


Integration in a build system
-----------------------------

To integrate the use of gla11y in a build system, you can for instance add to
configure.ac:

	AC_PATH_PROG([GLA11Y], [gla11y], [true])

and introduce a new Makefile.am rule to trigger a call to gla11y:

	ui_files = foo.ui bar.ui

	GLA11Y_OUTPUT = ui-a11y.err
	GLA11Y_SUPPR  = ui-a11y.suppr
	GLA11Y_FALSE  = ui-a11y.false

	GLA11Y_V = $(GLA11Y_V_@AM_V@)
	GLA11Y_V_ = $(GLA11Y_V_@AM_DEFAULT_V@)
	GLA11Y_V_0 = @echo "  GLA11Y  " $@;
	GLA11Y_V_1 = 

	all-local: $(GLA11Y_OUTPUT)
	$(GLA11Y_OUTPUT): $(ui_files)
		$(GLA11Y_V) $(GLA11Y) -P $(srcdir)/ -f $(srcdir)/$(GLA11Y_FALSE) -s $(srcdir)/$(GLA11Y_SUPPR) -o $@ $(ui_files:%=$(srcdir)/%)

	CLEANFILES += $(GLA11Y_OUTPUT)
	EXTRA_DIST += $(GLA11Y_SUPPR) $(GLA11Y_FALSE)

and you can generate ui-a11y.suppr from an initial call to gla11y from the
source tree:

	gla11y -g ui-a11y.suppr foo.ui bar.ui

in order to ignore the existing warnings for a start.


From then on, the gla11y call will error out if new fatal warnings are produced,
thus avoiding the corresponding accessibility regressions.  The existing
warnings can then be worked on progressively, removing the corresponding
suppression rules from the .suppr files accordingly.  In case of false positives
from the tool, they can be transferred from the .suppr file to the .false file.
See HOWTO.md for more details on the methodology, which you can point developers
to.


Credits
-------

Gla11y was developped by Hypra (http://hypra.fr/) and Martin Pieuchot under
the funding of The Document Foundation tender to implement accessibility
improvements (#201704-01)